blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
389ec37fa582b3d379b01d13b3f9aa44265dd922
cvhs-cs-2017/sem2-exam1-jman7150
/Encrypt.py
1,703
4.34375
4
""" Write a code that will remove vowels from a string and run it for the sentence: 'Computer Science Makes the World go round but it doesn't make the world round itself!' Print the save the result as the variable = NoVowels """ def NoVowels(AnyString): newString = "" for ch in AnyString: if ord(ch) ...
true
a7181fd0ddfc4fba1b653e06e05c34d917690dbb
JoshuaMeza/ProgramacionEstructurada
/Unidad 3-Funciones/Ejercicio43.py
2,972
4.21875
4
""" Author Joshua Immanuel Meza Magana Version 1.0 Program who count how many positive and negative numbers are on N numbers, 0 break the count. """ #Functions def specifyNumbers(): """ It gets the N numbers that we will count. Args: _N (int): Value of the number of numbers Returns:...
true
cf56c17dc4d5d912013ef55466911dee5e042fda
ainnes84/DATA520_HW_Notes
/Get_Weekday.py
692
4.71875
5
def get_weekday(current_weekday, days_ahead): # or day_current, days_ahead """ (int, int) -> int Return which day of the week it will be days_ahead days from current_weekday. current_weekday is the current day of the week and is in the range 1-7, indicating whether today is Sunday (...
true
babb5f609272132392a4e6b6f7fa4209f62ac2d5
ainnes84/DATA520_HW_Notes
/file_editor.py
1,719
4.21875
4
import os.path def file_editor(writefile): while os.path.isfile(writefile): rename = input('The file exists. Do you want to rename the file? (y/n)') if rename == 'y': print ('I will rename the ' + writefile + ' file.') filename = input('Please give new file name (In .txt for...
true
ea313897b6a0b264b0f492b6275dc3d7d8c0ad2b
ainnes84/DATA520_HW_Notes
/count_duplicates.py
507
4.25
4
def count_duplicates(dictionary): """ (dict) -> int Return the number of values that appear two or more times. >>> count_duplicates({'A': 1, 'B': 2, 'C': 1, 'D': 3, 'E': 1}) 1 """ duplicates = 0 values = list(dictionary.values()) for item in values: if values.count(item) >= 2...
true
87d9533f914f4a0cb9c25fbe838a45acd24b303c
kenny2892/RedditProfileSaver-C-Sharp
/Database/sqlite_helper.py
1,467
4.21875
4
import sqlite3 from sqlite3 import Error # Source for how to use Sqlite in Python: https://www.sqlitetutorial.net/sqlite-python/ def create_connection(db_file): """ create a database connection to the SQLite database specified by db_file :param db_file: database file :return: Connection object or N...
true
20cff6b03d5d7d2cb34b24adc911f05701fb190f
ritasonak/Python-Samples
/Pluralsight/Fundamentals/Docstring_Demo.py
470
4.125
4
"""Retrieve and print words from a URL """ import urllib2 def fetch_words(url): """Fetch a list of words from URL. :param url: The URL of a UTF-8 text document. :return: A list of strings containing the words from the document. """ story = urllib2.urlopen(url) story_words = [...
true
4f7140f2b36c772bee6f83d865e7fa2205c06979
kmerchan/holbertonschool-interview
/0x1C-island_perimeter/0-island_perimeter.py
2,591
4.28125
4
#!/usr/bin/python3 """ Defines function to calculate the perimeter of an island represented by a list of list of ints """ def island_perimeter(grid): """ Calculates the perimeter of an island represented by a list of list of ints parameters: grid [list of list of ints]: represents the island & su...
true
b1e36c377de098bebae5361b8bb64df364612c22
ASHWINIBAMBALE/Calculator
/calculator.py
818
4.15625
4
def add(n1,n2): return n1+n2 def subtract(n1,n2): return n1-n2 def multiply(n1,n2): return n1*n2 def divide(n1,n2): return n1/n2 operations={ "+":add, "-":subtract, "*":multiply, "/":divide } def calculator(): num1=float(input("Enter the first number:"))...
true
926051d16f0ca8e3a19d98e8460c9ed27ea19700
ehedaoo/Practice-Python
/Basic28.py
412
4.1875
4
# Write a Python program to print out a set # containing all the colors from color_list_1 which are not present in color_list_2. # Test Data : # color_list_1 = set(["White", "Black", "Red"]) # color_list_2 = set(["Red", "Green"]) # Expected Output : # {'Black', 'White'} color_list_1 = set(["White", "Black", "Red"]) co...
true
9b9912a3790e0af2a0fb1dc0ece3afcd3e5e990f
ehedaoo/Practice-Python
/Basic4.py
212
4.28125
4
# Write a Python program which accepts the user's first and last name # and print them in reverse order with a space between them. name = input("Enter your name please: ") if len(name) > 0: print(name[::-1])
true
8331b70e425b25d1cf4f1f8a08bfd316b4af4978
ehedaoo/Practice-Python
/Basic3.py
254
4.40625
4
# Write a Python program which accepts the radius of a circle from the user and compute the area. import math radius = int(input("Enter the radius of the circle: ")) area1 = math.pi * pow(radius, 2) print(area1) area2 = math.pi * radius**2 print(area2)
true
7352122a917e1228a98fdb984a84c1852852b3e6
ehedaoo/Practice-Python
/Basic35.py
552
4.3125
4
# Write a Python program to add two objects if both objects are an integer type. def add_numbers(a, b): if not (isinstance(a, int) and isinstance(b, int)): raise TypeError("Inputs must be integers") return a + b obj1 = int(input("Enter an integer 1: ")) obj2 = int(input("Enter an integer 2: ")) print...
true
8e4912c44b713408b18770aa1599ecdc4b120c14
azrap/python-rest-heroku-deploy
/test.py
762
4.34375
4
import sqlite3 connection = sqlite3.connect('data.db') cursor = connection.cursor() create_table = "CREATE TABLE users (id int, username text, password text)" cursor.execute(create_table) # must be a tuple user = (1, 'jose', "superpass") # the ? signifies parameters we'll insert # must insert tuple with the...
true
69d66c38bbe996130ab3b880db60785903f3ec82
IPostYellow/python100day
/7天专题函数/Day1.py
1,595
4.28125
4
'''第一天''' ''' 1.python中的函数是什么? 答:函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段, 只有在被调用时才会执行。要在Python中定义函数,需要使用def关键字。 ''' ''' 2.python2和python3的range(100)的区别 python2返回列表,python3返回迭代器,节约内存 ''' ''' 3.fun(args,**kwargs)中的args,**kwargs什么意思? 答:*args 和 **kwargs主要用于函数定义。你可以将不定数量的参数传递给一个函数。 这里的不定的意思是:预先并不知道函数的使用者会传递多少个参数给你, 所以在这个场景下使用这两个关键...
false
a29906f6d600932ae8eb65adc4351ca5e9f1ff0e
Mukesh656165/Strings_datatypes
/str_programme.py
652
4.125
4
# write a programme to reverse a string #Tech 1-> Using of slice method s = 'rekoj' op = s[::-1] print(op) # when using slice oprator step size should be a pos or neg number otherwise error op1= s[::0] print(op1) # take input from user s1 = input('enter a string to reverse :') ops1= s1[::-1] print(ops1) #Tech -2 p =...
false
508f310f385227201fccef2cfdfb8ebbcfd071b0
rahcosta/Curso_em_Video_Python_3
/Parte 2/9.5. Simulador de Caixa Eletrônico.py
960
4.125
4
'''Crie um programa que simule o funcionamento de um caixa eletrônico. No início, pergunte ao usuário qual será o valor a ser sacado (número inteiro) e o programa vai informar quantas cédulas de cada valor serão entregues. OBS: considere que o caixa possui cédulas de R$50, R$20, R$10 e R$1.''' print('-=' * 15) print('...
false
d09f6c8bfde750e9da883818308f201d5326a999
rahcosta/Curso_em_Video_Python_3
/Parte 2/6.2. Conversor de bases numéricas.py
768
4.1875
4
# ESCREVA UM PROGRAMA QUE LEIA UM NÚMERO INTEIRO QUALQUER E PEÇA PARA O USUÁRIO ESCOLHER # QUAL SERÁ A BASE DE CONVERSÃO: # 1 PARA BINÁRIO; # 2 PARA OCTAL; #3 PARA HEXADECIMAL. n = int(input('Digite o número a ser convertido: ')) print('Escolha a base de conversão:') print('[ 1 ] converter para BINÁRIO \n[ 2 ] convert...
false
26c1a999204f51d76d53497f3e14b2494e57cf07
rahcosta/Curso_em_Video_Python_3
/Parte 2/8.7. Sequência de Fibonacci.py
647
4.1875
4
'''Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci. Exemplo: 0 – 1 – 1 – 2 – 3 – 5 – 8''' '''Os números seguintes são sempre a soma dos dois números anteriores. Portanto, depois de 0 e 1, vêm 1, 2, 3, 5, 8, 13, 21, 34…''' elementos = i...
false
a753c60df2e85e2e803c4632c53c3dde31dbc787
rahcosta/Curso_em_Video_Python_3
/Parte 2/8.2. Jogo da Advinhação 2.py
936
4.125
4
'''Melhore o jogo do exercício 5.1 onde o computador vai “pensar” em um número entre 0 e 10. Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer.''' from random import randint from time import sleep print('-' * 50) print('Vamos ver se você é bom e...
false
577263315755fd659705d83036e18c842096c63f
GitHubToMaster/PythonProgramFromIntroToPrac
/python_work/第一部分/cars.py
584
4.46875
4
cars = ['bmw', 'audi', 'toyota', 'subaru'] cars.sort() #按照字母顺序升序排序,会对列表进行永久性修改 print(cars) cars.sort(reverse=True) #按照字母顺序降序排序,会对列表进行永久性修改 print(cars) cars2 = ['bmw', 'audi', 'toyota', 'subaru'] ## 进行临时性排序 print(sorted(cars2)) print(sorted(cars2, reverse=True)) print(cars2) ## 对列表进行反转:倒着打印列表, cars3 = ['bmw', 'audi'...
false
5cb40df0d005df2a3c0caf071285b30911b6a0d2
dduong7/dduong7-_pcc_cis012_homework
/Module 4/mathematical.py
951
4.375
4
# Create two variables (you pick the name) that have an integer value of 25,000,000 but one uses underscores as a # thousand separator and the other doesn't. var_int = 25000000 varr_int = 25_000_000 # Print out each variable using an f string with the following format "<Var Name>: <Var Value>" where <Var Name> is # r...
true
573c91766b1ece833891767b7c6a7ef7ae306398
joew1994/isc-work
/python/tuples.py
543
4.15625
4
#a TUPLE = a sequence like a list, except it can not be modified once created # created using normal brackets instead of square brackets #but still index with square brackets #emunerate function = produces index and values in pairs. #question 1 t = (1,) print t print t[-1] tup = range(100, 200) print tup tup2 =...
true
6eccdf6c93349b1885f911e2a863bc95e39f07d3
sdrsnadkry/pythonAssignments
/Functions/7.py
361
4.28125
4
def count(string): upperCount = 0 lowerCount = 0 for l in string: if l.isupper(): upperCount += 1 elif l.islower(): lowerCount += 1 else: pass print("Upper string Count: ", upperCount, "\nLower String Count: ", lowerCount) string =...
true
8e9d4540f197553ce8ee741201507c04075b4bd2
danijar/training-py
/tree_traversal.py
1,945
4.34375
4
from tree import Node, example_tree def traverse_depth_first(root): """ Recursively traverse the tree in order using depth first search. """ if root.left: yield from traverse_depth_first(root.left) yield root.value if root.right: yield from traverse_depth_first(root.right) de...
true
fa1c5da5d10b4a3b1e1a5b39301ad98c11294a89
danijar/training-py
/digits_up_to.py
2,656
4.25
4
def digits(number): """Generator to iterate over the digits of a number from right to left.""" while number > 0: yield number % 10 number //= 10 def count_digits_upto(the_number, the_digit): """Count the amount of digits d occuring in the numbers from 0 to n with runtime complexity of ...
true
75005f329735e2d241747d7d2cda7b06d6e30c94
crystalDf/Automate-the-Boring-Stuff-with-Python-Chapter-01-Python-Basics
/MathOperators.py
258
4.1875
4
# ** Exponent print(2 ** 3) # % Modulus/remainder print(22 % 8) # // Integer division/ oored quotient print(22 // 8) # when the * operator is used on one string value and one integer value, # it becomes the string replication operator. print('Alice' * 5)
true
078d077ae95661565d3e657a19a8496b07a033e0
jcburnworth1/Python_Programming
/computer_science/towers_of_hanoi_stacks/towers_of_hanoi_script.py
2,841
4.3125
4
## Towers of Hanoi - CodeAcademy from computer_science.towers_of_hanoi_stacks.stack import Stack ## Start the game print("\nLet's play Towers of Hanoi!!") # Create the Stacks stacks = [] left_stack = Stack("Left") middle_stack = Stack("Middle") right_stack = Stack("Right") ## Add each individual stack in a large list...
true
b85a5495b451c01f5c992521c88e0514eb4be948
jcburnworth1/Python_Programming
/basic_python/scrabble_functions.py
2,600
4.28125
4
## Scrabble - CodeAcademy ## Initial Variables letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] points = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10] ## Combin...
true
e835849a8f28383c7368a132f7f936fe4a18a7a7
JoeltonLP/python-exercicios
/ex004.py
600
4.25
4
#!/usr/bin/python3 # Faca um programa que leia algo pelo teclado e mostre na tela o seu tipo #primitivo e todas as informacoes possiveis sobre ele. something = input('Type something: ') print('which type primitive value? {}' .format(type(something))) print('only have space? {}' .format(something.isspace())) print('i...
false
baf1c9013f89e4e73e46ec3bac27f915ca6fb3fd
redi-vinogradov/leetcode
/rotate_array.py
398
4.1875
4
def rotate(nums, k): """ The trick is that we are moving not just each value but slice of array to it's new position by calculating value of modulus remainder """ k = k % len(nums) if k == 0: return nums[:k], nums[k:] = nums[-k:], nums[:-k] print(nums) def main(): nums = [1,2,3,...
true
e2c2a407cb7422c4529db7131b41aee5f065c027
aragaomateus/PointOfService
/Main.py
1,576
4.15625
4
''' Creating the restaurant pos program in python''' from Table import Table # Function for initializing the table objects assingning a number to it. def initiateTables(): tablesGrid = [Table(i) for i in range(21)] return tablesGrid # Function for printing the floor map when needed. def printTables(tables): ...
true
487e4a3fdbb30210d7a0faad073437bc88eb6892
m120402/maule
/server.py
1,859
4.15625
4
import socket # Tutorial came from: # https://pythonprogramming.net/sockets-tutorial-python-3/ # create the socket # AF_INET == ipv4 # SOCK_STREAM == TCP # The s variable is our TCP/IP socket. # The AF_INET is in reference to th family or domain, it means ipv4, as opposed to ipv6 with AF_INET6. # The SOCK_STREAM ...
true
4b6a42ff50842c497db16d19844b41ca8a23de27
huangsam/ultimate-python
/ultimatepython/classes/basic_class.py
2,673
4.625
5
""" A class is made up of methods and state. This allows code and data to be combined as one logical entity. This module defines a basic car class, creates a car instance and uses it for demonstration purposes. """ from inspect import isfunction, ismethod, signature class Car: """Basic definition of a car. W...
true
1233b07fb7e52520645d588af089fee900483281
huangsam/ultimate-python
/ultimatepython/syntax/loop.py
2,727
4.4375
4
""" Loops are to expressions as multiplication is to addition. They help us run the same code many times until a certain condition is not met. This module shows how to use the for-loop and while-loop, and also shows how `continue` and `break` give us precise control over a loop's lifecycle. Note that for-else and whil...
true
5191ec83e749d9e838e1984665e9a250069bcf84
Yanaigaf/NextPy-Coursework
/nextpy1.1.py
982
4.25
4
import functools # 1.0 - write a oneliner function that attaches a symbol to every element of an iterable # and prints all elements as a single string def combine_coins(symbol, gen): return ", ".join(map(lambda x: symbol + str(x), gen)) print(combine_coins('$', range(5))) # 1.1.2 - write a oneliner function t...
true
2fa430c5e0cee76e4e9a8beecbbb4f63a2530739
cmhuang0328/hackerrank-python
/introduction/2-python-if-else.py
588
4.125
4
#! /usr/bin/env python3 ''' Task Given an integer, , perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of to , print Not Weird If n is even and in the inclusive range of to , print Weird If n is even and greater than , print Not Weird Input Format A single li...
true
9f1dc01dcb82ca4d2d6e223e8f43be93aa744b43
CristianoFernandes/LearningPython
/exercises/Ex_033.py
676
4.1875
4
print('#' * 45) print('#' * 15, 'Exercício 033', '#' * 15) numero = int(input('Digite o primeiro numero: ')) numero2 = int(input('Digite o segundo numero: ')) numero3 = int(input('Digite o terceiro numero: ')) # Testa menor menor = numero if menor > numero2: menor = numero2 if menor > numero3: menor = numero3 ...
false
2bbd8eeb959c2eb53dfe860f1b835df62ad3a131
Archana-SK/python_tutorials
/Handling_Files/_file_handling.py
2,036
4.21875
4
# File Objects # r ---> Read Only, w ---> Write Only, a ---> Append, r+ ---> Read and Write # Reading file without using Context manager f = open('read.txt', 'r') f_contents = f.read() print(f_contents) f.close() # Reading file Using Context Manager (No need to close the file explicitly when file is opened using con...
true
10beb77fb6294dcb65c43870f26d86efae24096e
AndreiKorzhun/CS50x
/pset7_SQL/houses/roster.py
870
4.125
4
import cs50 import csv from sys import argv, exit # open database for SQLite db = cs50.SQL("sqlite:///students.db") def main(): # checking the number of input arguments in the terminal if len(argv) != 2: print(f"Usage: python {argv[0]} 'name of a house'") exit(1) # sample of students of...
true
f2f35bd0fa2e0a0bde87df9ca4274f8e1124ef37
remycloyd/projects
/python Programs/miningRobots.py
1,247
4.125
4
# You are starting an asteroid mining mission with a single harvester robot. That robot is capable of mining one gram of mineral per day. # It also has the ability to clone itself by constructing another harvester robot. # That new robot becomes available for use the next day and can be involved in the mining process o...
true
0bf11b0e84d68cd7ddc03aa21afb1ca27c75cf61
balaji-s/Python-DSA
/mergesort.py
1,197
4.15625
4
count = 0 def mergesort(array_elements): global count if len(array_elements) > 1: midpoint = len(array_elements)//2 left_half = array_elements[:midpoint] right_half = array_elements[midpoint:] #print(left_half) #print(right_half) mergesort(left_half) mer...
false
b671e84a60e0ca80d31d0d502ada7307005ed206
Nickbonat22/CIS210
/p51_binaryr.py
2,722
4.25
4
''' Binary Encoding and Decoding Recursively CIS 210 F17 Project 5, Part 1 Author: Nicholas Bonat Credits: Convert a non-negative integer to binary recursively and prints it. Then converts back to decimal form and prints the value. ''' import doctest def dtob(n): '''(int) -> str Function dtob takes non-n...
true
c660f52deb7cbf8ee3cbe223e4611cc4971edb2a
Nickbonat22/CIS210
/p1_2_fizzbuzz.py
998
4.21875
4
''' Fizzbuzz CIS 210 F17 Project 1-2 Author: Nicholas Bonat Credits: N/A Print a number or word based on if that number is divisble by 3,5, or both. ''' def fb(n): '''(int) -> None Print 1 through n with every number divisible by 3 printing fizz, every number divisible by 5 pri...
false
878ad2087a24100fce96b6cf80feb543fae809f1
gordwilling/data-structures-and-algorithms
/unscramble-computer-science-problems/Task4.py
1,297
4.25
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv from operator import itemgetter with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4:...
true
b848295a1ae8ed1915d00addf29610a1f218c167
Hosen-Rabby/Learn-Python-The-Hard-Way
/access tuple items.py
413
4.4375
4
print("Can Access Tuple Items-by referring to the index number, inside square brackets") thistuple = ("kat", "Gari", "toy","Laptop","TV") print(thistuple[2]) print("Negative Indexing") print("refers to the last item -",thistuple[-1]) print("refers to the 2nd last item -",thistuple[-2]) print("Range of Indexes...
true
2f6886c8bce04639b618373074366bc9587e011f
nathanbrand12/training
/src/upperCase.py
801
4.15625
4
# message = 'Fugazi and his diamonds' # message_2 = 'the plug' # full_sentence = message + " " + message_2 # print(message.lower()) # '-----------------------' # print(message.upper()) # '-----------------------' # print(full_sentence.upper()) # '------------------------' # print(full_sentence.lower()) print("MATHEMAT...
false
0065eda3217c9a30b9d1950134dc7ee2e32cecff
nathanbrand12/training
/src/LCM.py
681
4.15625
4
# def lcm(x, y): # if x > y: # greater = x # else: # greater = y # while(True): # if((greater % x == 0) and (greater % y == 0)): # lcm = greater # break # greater += 1 # return lcm # # num1 = float(input("Input first number: ")) # num2 = float(input("Input secon...
true
99bf18bfd7ff60cfd5232c098ac24abc46322804
datdev98/cryptography
/cipher/additive_cipher.py
632
4.125
4
plain = 'abcdefghijklmnopqrstuvwxyz' cipher = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def encrypt(plain_text, key): text = '' for ch in plain_text: text += cipher[(plain.index(ch) + key) % 26] return text def decrypt(cipher_text, key): text = '' for ch in cipher_text: text += plai...
false
ba649ccca5473151dc9589d6af7ad1e6f5ecec70
Neftali56/Tarea-02
/porcentajes.py
748
4.15625
4
#encoding: UTF-8 # Autor: Neftalí Rodríguez Martínez, A01375808. # Descripcion: Este programa lee el número de mujeres y hombres inscritos en una clase, calcula el número de alumnos # inscritos, así como el porcentaje respectivo de mujeres y hombres. # A partir de aquí escribe tu programa num_mujeres = int (input("I...
false
2116093f8ffbfa923aadafb438783606230009c4
varshinicmr/varshinivenkatesh
/operators.py
1,502
4.125
4
def add(a,b): return a+b def sub(a,b): return a-b def mult(a,b): return a*b def divide(a,b): return a/b i=int(input("enter value of a: ")) j=int(input("enter value of b: ")) o=input("what do you want to do? +,-,*,/: ") if(o=='+'): res=add(i,j) elif(o=='-'): res=sub(i,j) elif(o=='*'): res=mult(i,j) elif(o=='/')...
false
40d1883293de62280485ab3c60ff6616b4ef1e8f
liangjian314/thinkpython2
/chapter6:有返回值的函数/exercise6_2.py
782
4.25
4
# 回文词(palindrome)指的是正着拼反着拼都一样的单词,如 “noon”和“redivider”。 按照递归定义的话,如果某个词的首字母和尾字母相同,而且中间部分也是一个回文词,那它就是一个回文词 # 编写一个叫 is_palindrome 的函数,接受一个字符串作为实参。如果是回文词,就返回 True ,反之则返回 False。记住,你可以使用内建函数 len 来检查字符串的长度。 def first(word): return word[0] def last(word): return word[-1] def middle(word): return word[1:-1] def...
false
3d3614529418f856f6ebeb6f6ca8c526a91ba707
liangjian314/thinkpython2
/chapter9:文字游戏/exercise9_5.py
360
4.125
4
# 编写一个名为uses_all的函数,接受一个单词和一个必须使用的字符组成的字符串。 # 如果该单词包括此字符串中的全部字符至少一次,则返回True。 def uses_all(word, uses_str): for letter in uses_str: if letter not in word: return False return True print(uses_all('hell', 'hello'))
false
7f2fc6389628f4d74de363e5cea3327d3041bf39
ankitbansal2101/data-structures
/queue.py
1,731
4.1875
4
#fifo(first in first out) #using list q=[] q.insert(0,"a") q.insert(0,"b") q.insert(0,"c") q.pop() #using deque from collections import deque q=deque() q.appendleft("a") q.appendleft("b") q.appendleft("c") q.pop() #using inbuilt queue # Initializing a queue q = Queue(maxsize = 3) # qsize() give the maxsize #...
true
6d7c431c0d4d2d4938f1f939fe4f3b19096bdee5
karinsasaki/Python_ML_projects
/guess_number_game/build/lib/guess_number_game/guess_number.py
2,850
4.25
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 8 12:56:50 2020 @author: sasaki """ import random import guess_number_game.utils as utils #class Chosen: # """Class of the chosen number. # # min_bound (int>=0): minimum bound of range the program can choose a number from. Default is 0. # ...
true
4f88343db2cd456fa3930da1b2ee0cf0d8793be1
TARUNJANGIR/FSDP_2019
/DAY2/Hands_On_1.py
383
4.28125
4
# -*- coding: utf-8 -*- """ Created on Tue Jun 4 16:51:39 2019 @author: HP """ # Create a list of number from 1 to 20 using range function. # Using the slicing concept print all the even and odd numbers from the list our_list = list(range(21)) print (type(our_list)) print (our_list) print ('even numbers>') print (...
true
2453dad75840fdb875fb6be8b330afa77c70e60d
KhairulIzwan/Python-for-Everybody
/Values and Types/Exercise/3/main.py
732
4.6875
5
#!/usr/bin/env python3 """ Assume that we execute the following assignment statements: width = 17 height = 12.0 For each of the following expressions, write the value of the expression and the type (of the value of the expression). 1. width//2 2. width/2.0 3. height/3 4. 1 + 2 \* 5 """ # width = 17 height = 12.0...
true
40517f70d8c803ea2ed1184d6428d47b896d38b7
michaelamican/python_starter_projects
/Python_Fundamentals/Functions_Basic_II.py
1,511
4.3125
4
#Countdown - Create a function that accepts a number as an input. Return a new array that counts down by one, from the number (as arrays 'zero'th element) down to 0 (as the last element). For example countDown(5) should return [5,4,3,2,1,0]. def count_down(int): i = int while i >= 0: print(i) i -=...
true
5e3d78e715d03ac40400cc9ae33bf35b396be8bb
Ylfcynn/Python_Practice
/Python/TensorFlow/data_format.py
1,397
4.125
4
""" Deep Learning Using TensorFlow: Introduction to the TensorFlow library An exercise with Matt Hemmingsen A subfield of machine learning, inspired by the structure and function of the brain, often called artificial neural networks. Deep learning can solve broader problems without specifically defining each feature...
true
423d2342360be47f1af94b4c9388a286dcc2235d
Ylfcynn/Python_Practice
/Python/atm-interface/atm_interface.py
2,739
4.3125
4
""" This is a menu for accessing a user's account. Logic is located in account.py """ from account import Account import pychalk acct = Account # pep484 annotations USER_ACCOUNTS = dict() # Refactor this. If it stays global, UPPERCASE! def user_menu(account): """ Displays a menu of user opt...
true
f56fbddeba596cb59d85c15de2aa5145769c2eb7
Ylfcynn/Python_Practice
/credit.py
1,799
4.375
4
""" Goal Write a function which returns whether a string containing a credit card number is valid as a boolean. Write as many sub-functions as necessary to solve the problem. Write doctests for each function. -------------------- Instructions 1. Slice off the last digit. That is the **check digit**. 2. Reverse the ...
true
dfd12c2fa65c0f412c9eb6d14003ee4b21447697
Ylfcynn/Python_Practice
/hammer.py
1,655
4.1875
4
""" Write a function that returns the meal for any given hour of the day. Breakfast: 7AM - 9AM Lunch: 12PM - 2PM Dinner: 7PM - 9PM Hammer: 10PM - 4AM >>> meal(7) 'Breakfast time.' >>> meal(13) 'Lunch time.' >>> meal(20) 'Dinner time.' >>> meal(21) 'No meal scheduled at this time.' >>> meal(0) 'Hammer time.' >>> meal(...
true
7486275b192534951ab95cecd52e752faa2d4e03
VakinduPhilliam/Python_Data_Mapping
/Python_List_Comprehensions.py
495
4.125
4
# Python Data Structures List Comprehensions # List comprehensions provide a concise way to create lists. # Common applications are to make new lists where each element is the result # of some operations applied to each member of another sequence or iterable, # or to create a subsequence of those elements that s...
true
1e5a4bbcf9b1a60bb2a882e12d2d02d49797c272
VakinduPhilliam/Python_Data_Mapping
/Python_List_Comprehensions (Example).py
847
4.375
4
# Python Data Structures List Comprehensions # List comprehensions provide a concise way to create lists. # Common applications are to make new lists where each element is the result # of some operations applied to each member of another sequence or iterable, # or to create a subsequence of those elements that s...
true
73e15841e0a78a26eed4a1e70ec7ba5ad684d649
nealorven/Python-Crash-Course
/1_Chapter_Basics/6_Dictionaries/Exercises/6_12_extension.py
739
4.15625
4
# Улучшение предыдущего кода. cities = { 'rio de janeiro': { 'country': 'brazil', 'population': 6.32, 'fact': 'guanabara bay', }, 'florence': { 'country': 'italy', 'population': 382.347, 'fact': 'cattedrale di santa maria del fiore', }, 'venic...
false
e68972eea98411d80c0f9386cc34a90ceec75132
nealorven/Python-Crash-Course
/1_Chapter_Basics/3_Lists/8_sort.py
358
4.1875
4
# Метод sort() сортирует от A..Z: cars = ['bmw', 'audi', 'toyota', 'subaru'] cars.sort() # Постоянное изменение порядка print(cars) # ['audi', 'bmw', 'subaru', 'toyota'] # от Z..A cars.sort(reverse=True) # Постоянное изменение порядка print(cars) # ['toyota', 'subaru', 'bmw', 'audi']
false
d7c3c6c4a14ffb9b23f57fcfbab464a35963b7f5
nealorven/Python-Crash-Course
/1_Chapter_Basics/7_While_cycles/Exercises/7_3_multiples_of_10.py
324
4.21875
4
number = input("Enter a multiple of 10: ") number = int(number) if number % 10 == 0: print(f"\nThe number {str(number)} is multiple.") else: print(f"\nThe number {str(number)} not multiple.") # Enter a multiple of 10: 101 # The number 101 not multiple. # Enter a multiple of 10: 110 # The number 110 is multip...
true
bac7551316b9025f88671c580126d591119d2b62
nealorven/Python-Crash-Course
/1_Chapter_Basics/5_if_Operator/Exercises/Interactive/2_for_if_else.py
406
4.28125
4
names = { 'robert green':'robertgreen@gmail.com', 'neal orven':'nealorven@gmail.com', 'alen frojer':'alenfrojer@gmail.com', 'bob eron':'boberon@gmail.com' } name_search = input("Write your username to search for a mailing address: ") for name, mail in names.items(): if name_search in name: ...
true
17cc17340c7e0144ec4abf5d80c4675d873cde3c
webAnatoly/learning_python
/fromPythonBook/uniquewords1.py
641
4.125
4
#!/usr/bin/env python3.4 ''' Here is a program from a study book that I'm reading. The programm lists every word and the number of times it occurs in alphabetical order for all the files listed on the command line: ''' import string import sys words = {} strip = string.whitespace + string.punctuation + string.digits + ...
true
c0dad9e3f04b628492da4feec32e5f97ac6be3e9
ash301/kuchbhi
/leap.py
734
4.4375
4
#take the year as input def function(year): leap = False if(year%4 == 0): if(year%100 == 0): if(year%400 == 0): leap = True else: leap = True return leap year = int(input("Enter the Year : ")) print function(year) #Documentation taken from url: #https://support.microsoft.com/en-in/kb/21401...
true
798b22bb29bce19bf46d4583a2d3422bc9e428fc
joaoaffonsooliveira/curso_python
/desafios/desafio04.py
719
4.28125
4
# Dissecando uma variável variavel_dissecada = input('Digite a variável que você quer dissecar: ') print('O tipo primitivo da variável {} é: '.format(variavel_dissecada), type(variavel_dissecada)) print('{} Só tem espaços?'.format(variavel_dissecada), variavel_dissecada.isspace()) print('{} É alfabético?'.format(varia...
false
cf46bee5eb0a3ba95addb4a25960331c39003d81
3mRoshdy/Learning-Python
/09_generators.py
472
4.28125
4
# Generators are simple functions which return an iterable set of items, one at a time, in a special way. # Using 'yield' keyword for generating Fibonacci def fib(): a,b = 1,1 while 1: yield a a, b = b, b + a # testing code import types if type(fib()) == types.GeneratorType: print("Good, Th...
true
790d755e7834ad0e9a081d74a4b087c6e656466e
ikarek-one/zoom-decoder
/zoomChatDecoderVer2.py
2,619
4.125
4
print("Decoding Zoom chat .txt-s") print("Enter the name (or path) of your .txt file!") print("Examples: myFile.txt OR C:/Documents/meeting_saved_chat.txt") fileName = input("Name of file: \n") if(fileName == ""): fileName = "meeting_saved_chat.txt" print("\nEnter 'save' if you want to save your file. T...
true
4c9eaad51acdfb0bdaa4d9c9faa6a2a4435ff63d
G3Code-CS/Intro-Python-I
/src/14_cal.py
2,176
4.53125
5
""" The Python standard library's 'calendar' module allows you to render a calendar to your terminal. https://docs.python.org/3.6/library/calendar.html Write a program that accepts user input of the form `14_cal.py month [year]` and does the following: - If the user doesn't specify any input, your program should ...
true
cef0c723b7f0ad7212ea8fbd5c80af1a8b039635
tgaye/Learn_Python_the_Hard_Way
/ex11.py
668
4.21875
4
# ex.11 User Inputs print('How old are you?', end=' ') age = input() print('How tall are you?', end=' ') height = input() print('How much do you weigh (lbs?)?', end=' ') # imperial system bc im an ignorant American. weight = input() print(f'So, you\'re {age} old, {height} tall and {weight} lbs heavy'.format(age, hei...
true
9f7abd5a59f1514adb0be406e8dc20bb3ce2ba18
hello-lily/learngit
/pytest/ex18.py
683
4.21875
4
# this one is like your scripts with argv def print_two ( *args): arg1,arg2 =args print ("arg1: %r, arg2: %r" % (arg1, arg2)) #ok, that *args is actually pointless, we can just do this # so what is*args? means a lot of strings def print_two_again(arg1, arg2): print ("arg1: %s, arg2: %s" % (arg1, arg2)) # %r the...
true
35ad81c072dbe045d00dde3113728edabc6d09a3
00dbgpdnjs/combine_img
/combine_img/lst_reverse_and_zip.py
965
4.625
5
# reverse() vs reversed() lst = [1, 2, 3, 4, 5] print(lst) lst.reverse() # reverse() : Reverse the order of "lst" print(lst) lst2 = [1, 2, 3, 4, 5] print("lst2 뒤집기 전 : ", lst2) # reversed() : Return a return var which is reversed ; lst2 is not changed unlike "lst" lst3 = reversed(lst2) print("리트스 2 뒤집은 후 ...
false
7e50f0fb6350e90dd0ac133337b1f2e45302d370
Crillboy314/Curso-Basico-Python
/Parte I/Script1.py
2,554
4.40625
4
""" Script 1: Tipo de datos, ejecución de códigos y consola Autor: kevinrojas """ """ Este archivo fue presentado mientrás se impartía el curso de python. """ # PRINT es nuestra expresión con el exterior print("Hola Mundo") print("Hola", "Mundo") print("Hola" + "Mundo") # ademas permite resolver calculos simples (u...
false
343d8ddec7f5d12ce721c94b2c9dd96e53930147
vchatchai/bootcamp-ai
/week1/tuple-cheat-sheet.py
882
4.78125
5
# %% """ - By convention, we generally use tuple for different datatypes and list for similar datatypes - Since tuple are immutable, then iteration througth tuple is faster than with list!!! - Tuple that contain immutables elements can be used as key for a dictionary. With list, this is NOT possible. - If you have...
true
6778b4cadbf8b1530bc949cf7903dafdc4c07edc
jdfdoyley/python_list
/python_list.py
998
4.5
4
# Create a list # ============= # A list of integers numbers = [1, 2, 3, 4, 5] # A list of Strings names = ["Josephine", "Jess", "Marsha", "Krystal"] # A list of mixed type employee = [ "Jessie", "Lewis", 30, (1761, "S Military Hwy", "Norfolk", "VA", 23502), True ] # An empty list empty_list = [] # The lis...
true
92854e6164be7f96190de56031e29ce0bd43ec1a
lef17004/Daily-Coding-Challenges
/8:17-9:3 2020/reverse_list.py
951
4.59375
5
############################################################################### """ Reverse List 8/19/2021 Time Complexity: O(n) Description: Write function that reverses a list, preferably in place. """ ############################################################################### def reverse_list(list,...
true
76cd6f0dd04037b7e085da5d0a7f5d556345a567
lef17004/Daily-Coding-Challenges
/8:17-9:3 2020/bubble_sort.py
1,197
4.21875
4
############################################################################### """ Bubble Sort 8/17/2021 Time Complexity: O(n^2) Description: Starting from the beginning of the list, compare every adjacent pair, swap their position if they are not in the right order (the latter one is smaller than the former one)....
true
9d73704305095fe1886f53493f503cf7dfb7ac2e
sraakesh95github/Python-Course
/Homeworks/Homework 1/hw1_1.py
898
4.4375
4
import sys import math # Program to calculate the time taken for a ball to drop from a height for a given initial velocity #Set a constant value for acceleration due to gravity g = 9.81; #Get the height from which the ball is dropped s = int(input("Enter height : ")); #Check for the height range if s<10 or s>1000 : ...
true
b147b2c96fc928a21f25f9b5901be7a4fa88845d
DiamondGo/leetcode
/python/SortColors.py
1,588
4.125
4
''' Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively. Note: You are not suppose to use the libr...
true
3e2505c4409bfbe19aef3a9d3dd29d8d4eca1ea5
DiamondGo/leetcode
/python/SlidingWindowMaximum.py
1,300
4.125
4
''' Created on 20160511 @author: Kenneth Tse Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. For example, Given nums = [1,3,-1,-3...
true
1f6e8cee4146df934701eb652ddc89523ded93aa
antonyaraujo/Listas
/Lista04/Questao9.py
544
4.3125
4
'''Faça uma função que dado um número n retorne o n-ésimo número de Fibonacci. O número de fibonacci é dado por n0=0, n1=1, ni = ni-1+ni-2.''' def fibonacci(n): if n == 0: return 0 elif n == 1 or n == 2: return 1 else: fibonacci = 1 penultimo = 0 for i in range(1, n)...
false
da45103332d90801eeaf70e3ea6861d43c57a496
antonyaraujo/Listas
/Lista04/Questao4.py
812
4.28125
4
''' Escreva um programa que chame uma função que deve receber por parâmetro dois valores (um para comprimento e outro para largura), calcular e apresentar na tela a área de um retângulo, através da fórmula do retângulo = comprimento * largura. Repetir a chamada da função com a passagem de parâmetros enquanto não for di...
false
ac57e0a4885b8ae7de768fe249dade20208a15b5
antonyaraujo/Listas
/Lista04/Questao11.py
990
4.53125
5
''' Escreva um programa que contenha uma função que receba como parâmetros um caractere representando uma operação matemática (+,-,/,*) e dois números reais representando os operandos. Sua função deve efetuar a operação dada sobre os operandos e retornar o resultado. A função principal deve imprimir o resultado. (Obs.:...
false
2692298589c64d79dcf5d25ec4f59d03fff3cf64
antonyaraujo/Listas
/Lista06/Questao4.py
683
4.5625
5
'''Faça um programa que contenha uma função. Essa função deve receber uma string, dois números inteiros (representando posição inicial e posição final). A função deve construir uma substring da string recebida por parâmetro, sendo que esta substring é o intervalo, na string original, entre os dois valores também recebi...
false
2e62154aeea00630ab738fa1f98749f714aae44a
Rollbusch/Learning-Python
/Aulas/016.py
368
4.1875
4
# import math biblioeca de funções matemáticas from math import trunc # só importa uma função da biblioteca math num = float(input('Digite um número qualquer: ')) # trunc() somente quando for importado a função da biblioteca. print('O número {}, tem a parte inteira {}'.format(num, trunc(num))) #math.trunc() mostra a ...
false
af01fe43f281513beb6503b91fabc6d900e38489
yosoydead/recursive-stuff
/visualising recursion/bla.py
753
4.53125
5
from turtle import * t = Turtle() wind = Screen() #i use penup so that when the turtle is repositioned, it doesn't draw any lines t.penup() #starting position t.setposition(-300,-300) #make the turtle draw again t.pendown() #this is for speed test t.speed(9) #the method needs a turtle object to use to draw things...
true
f1e606e96dbea769da2adb4d543e5bd6b3a64c37
AlDBanda/Python-Functions
/main.py
2,177
4.46875
4
#def greet(): # return "Hello Alfred" #print(greet()) #============================ ''' Function with parameters ''' #def greet(name): # ''' # Greets a person passed in as argumrnt name: a name of a person to greet # ''' # return f"Hello {name}, Good morning" #print(greet("Felix")) #print(greet("Arlo"))...
true
a62e16ff90361d0e60103355fe85838c54c611c9
simgroenewald/NumericalDataType
/Numbers.py
876
4.34375
4
# Compulsory Task 1 Num1 = input("Enter your first number:")# Allows user to input their first number and saves it as variable number1 Num2 = input("Enter your second number:")# Allows user to enter their second number and saves it as variable number2 Num3 = input("Enter your third number:") # Allows the user to ent...
true
137ed3c9089d953574204d65fad08722db04a813
GayathriAmarneni/Training
/Programs/nToThePowern.py
239
4.375
4
# Program to calculate n to the power n. base = int(input("Enter a base number: ")) result = 1 counter = 0 while counter < base: result = result * base counter = counter + 1 print(base, "to the power of", base, "is", result)
true
4d13a1c0cddb9ab162b99df61875359b3617ad91
GayathriAmarneni/Training
/Programs/mToThePowern.py
270
4.375
4
#Program to calculate m to the power n. base = int(input("Enter base number: ")) exponent = int(input("Enter exponent number: ")) result = 1 for exponent in range(0, exponent + 1, 1): result = result * base print(base, "to the power of", exponent, "is", result)
true
6c1f1f2b78af6e4989c6bf0ebf8677e992e9e70e
datadiskpfv/basics1
/printing.py
874
4.21875
4
print('Hello World') print(1 + 2) print(7 * 6) print() print("The End") print("Python's strings are easy to use") print('We can even include "quotes" in strings') print("hello" + " world") # using variables greeting = "Hello" name = "Paul" print(greeting + name) print(greeting + ' ' + name) #greeting = 'Hello' #name ...
true
fdda56b607a15772990151abdc4a5d93a1bdcada
datadiskpfv/basics1
/sets.py
1,719
4.40625
4
# sets are mutable objects (unless you use a frozen set) # there is no ordering farm_animals = {"sheep", "cow", "hen"} print(farm_animals) wild_animals = set(["lion", "tiger", "panther", "elephant", "hare"]) print(wild_animals) wild_animals.add("horse") wild_animals.add("ant") print(wild_animals) # you can also use...
true
0cd37577dcd53530aaeb1988110fb141dfac3a24
sutclifm0850/cti110
/P4HW1_Sutcliffe.py
313
4.15625
4
#P4HW1 #Distance Travveled #Sutcliffe #March 25, 2018 speed = float(input('What is the speed of the vehicle in mph?')) time = int(input('How many hours has it traveled?')) print('Hour','\tDistance Traveled') for Hour in range(1, time + 1 ): distance = speed * Hour print(Hour,'\t',distance)
true
61d7528d11582fa50ee89b4e44a420f4e2e025ee
AthaG/Kata-Tasks
/6kyu/MultiplesOf3Or5_6kyu.py
715
4.25
4
'''If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in. Note: If the number is a multiple of both 3 and 5, only count it once. Als...
true
c43b4fcbd1989400e3bf9d78e1b9d319ebb5ffa9
AthaG/Kata-Tasks
/6kyu/FindTheOrderBreaker_6kyu.py
1,373
4.25
4
'''In this kata, you have an integer array which was ordered by ascending except one number. For Example: [1,2,3,4,17,5,6,7,8] For Example: [19,27,33,34,112,578,116,170,800] You need to figure out the first breaker. Breaker is the item, when removed from sequence, sequence becomes ordered by ascending. For Example...
true