blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2ff4e164e15623a045036ad189bfab2280086e68
kpatel1293/CodingDojo
/DojoAssignments/Python/PythonFundamentals/Assignments/12_ScoresAndGrades.py
907
4.375
4
# Assignment: Scores and Grades # Write a function that generates ten scores between 60 and 100. # Each time a score is generated, your function should display what the grade # is for a particular score. # Here is the grade table: # Score: 60 - 69; Grade - D # Score: 70 - 79; Grade - C # Score: 80 - 8...
true
fac7cceb04d13dc68e238e969a306522b51c73e9
kpatel1293/CodingDojo
/DojoAssignments/Python/PythonFundamentals/Assignments/9_FooBar.py
1,623
4.1875
4
# Optional Assignment: Foo and Bar # Write a program that prints all the prime numbers and all the perfect # squares for all numbers between 100 and 100000. # For all numbers between 100 and 100000 test that number for whether # it is prime or a perfect square. If it is a prime number, print "Foo". # If it is a pe...
true
a3b664d4fa3abcccc3cd93690ffe40b053ccf044
prkhrv/mean-day-problem
/meanday.py
1,050
4.53125
5
""" Mean days Problem: You are given a list with dates find thee mean day of the given list Explanation: Given that the range of day values are 1-7 while Monday = 1 and Sunday = 7 Find the "Meanest Day" of the list . "Meanest Day" is the sum of values of all the days divided by total number of days For Example:- ...
true
61895160c36dbfbaafb426cfdbdecc280d6475c9
lisu1222/towards_datascience
/jumpingOnClouds.py
1,833
4.28125
4
""" Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of...
true
01c591c32142f0cb206fbee55375e77ee798121e
momentum-cohort-2019-02/w2d3-word-frequency-rob-taylor543
/word_frequency.py
1,769
4.125
4
STOP_WORDS = [ 'a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', 'for', 'from', 'has', 'he', 'i', 'in', 'is', 'it', 'its', 'of', 'on', 'that', 'the', 'to', 'were', 'will', 'with' ] import string def clean(file): """Read in a string and remove special characters and stop words (keep spaces). Return the r...
true
cec4b8438e743ddce8a680a2d4791b3e75dcbb93
Nas-Islam/qa-python-exercises
/programs/gradecalc.py
687
4.21875
4
def gradeCalc(): print("Welcome to the Grade Calculator!") mathsmark = int(input("Please enter your maths mark: ")) chemmark = int(input("Please enter your chemistry mark: ")) physicsmark = int(input("Please enter your physics mark: ")) percentage = (mathsmark + chemmark + physicsmark) / 3 if p...
true
d0402a757ccb537d9916f827f061d2e55ea696e1
Dex4n/avaliacao-linguagem-II-n1
/ex_02.py
1,568
4.40625
4
#2 - Crie um classe Funcionário com os atributos nome, idade e salário. Deve ter um método aumenta_salario. # Crie duas subclasses da classe funcionário, programador e analista, implementando o método nas duas subclasses. # Para o programador some ao atributo salário mais 20 e ao analista some ao salário mais 30, mo...
false
b79293531edb30b52ab3e3d4cb83abece2e2b7a9
BeepBoopYeetYourScoot/GeneralPython
/basic_python/1_variables/numberTypes.py
781
4.1875
4
x = 2 y = 3 print(x/y) # В python 2 получился бы ответ 0, т.к. там было бы целочисленное деление print(type(y % x)) # Модульное деление всегда даёт целое число (остаток от деления числа на число) print(y // x) # Целочисленное деление реализовано отдельным оператором x = 4 y = 2 print(x/y) # В любом случае получа...
false
fff87a0aa35c151e1e4c94b3a43e44ace36287f2
BeepBoopYeetYourScoot/GeneralPython
/intermediate_python/2_algorithms/bubble_sort.py
929
4.28125
4
import random def generate_random_array(length: int): """Функция генерирует список длины *length*, который состоит из случайных целых чисел""" temp = [] for i in range(length): temp.append(random.randint(0, 101)) return temp array = generate_random_array(10) print(array) def bubble...
false
da785fbd6a17fa38518bdc5e42e30bf28cd0c302
Leonardo612/Entra21_Leonardo
/01-Exercicios/Aula001/Ex1.py
633
4.15625
4
#--- Exercício 1 - Variáveis #--- Crie 5 variáveis para armazenar os dados de um funcionário #--- Funcionario: Nome, Sobrenome, Cpf, Rg, Salário #--- Deve ser usado apenas uma vez a função print() #--- Cada dado deve ser impresso em uma linha diferente #--- O salário deve ser de tipo flutuante nome = input('Digite o ...
false
f68a1c9afe8a230e2b9e5ef79982be601a9b97bb
meahow/adventofcode
/2017/06/solution1_test.py
1,348
4.28125
4
import solution1 """ For example, imagine a scenario with only four memory banks: The banks start with 0, 2, 7, and 0 blocks. The third bank has the most blocks, so it is chosen for redistribution. Starting with the next bank (the fourth bank) and then continuing to the first bank, the second bank, and so on, the 7 b...
true
24cab64adff4d0da92ad5b941b501e355dacfd98
Iliyakarimi020304/darkT-Tshadow
/term 2/dark shadow51.py
320
4.125
4
number = input("Enter Number: ") counter = 0 numbers = [] sums = 0 while number != '0': if number.isdigit(): numbers.append(number) counter += 1 number = input("Enter Number: ") for n in numbers: sums += int(n) print(f"Your numbers{numbers}") print(f"Average of your numbers {sums/counter}")
true
5c64470d7d305603eb43654528cb7fd6ea78c1cb
MerchenCB2232/backup
/todolist.py
814
4.125
4
import pickle print ("Welcome to the To Do List :))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))") todoList = [] while True: print("Enter a to add an item") print("Enter r to remove an item") print("Enter l to load list") print("Enter p to print the list") print("Enter q to quit") choi...
true
64b8718c992320ddc1650100417cd4dcc5689b3e
davideduardo001github/tarea1python
/p4.py
1,416
4.625
5
""" 4.- Elabora un programa que me permita realizar la suma de dos matrices de 3x3. Cada uno de los elementos de la matriz deberá ser ingresado por el usuario. Una matriz en Python puede implementarse con listas dentro de listas. """ ## DECLARACIÓN DE MÉTODOS # Impresión de matrices nxn def printmatrix(mat): for i...
false
737263f3bdd1c1d0a6c64a021c9c125fe944a557
ldd257/python_ai
/com/learn/python/十、类/2. self.py
2,989
4.25
4
""" Python 的 self 相当于 C++ 的 this 指针。 类的方法与普通的函数只有一个特别的区别 —— 它们必须有一个额外的第一个参数名称(对应于该实例,即该对象本 身),按照惯例它的名称是 self 。在调用方法时,我们无需明确提供与参数 self 相对应的参数。 """ class Test: def prt(self): print(self) print(self.__class__) t = Test() t.prt() # <__main__.Test object at 0x000000BC5A351208> # <class '__main__.Test'> ...
false
df1a5647ba6cd504cf5e6dba183ca4aed1f276d5
jimbuho/hiring-test
/tests/test_stack.py
1,250
4.1875
4
""" Un Stack o Pila: el primer elemento en entrar es el primero en salir. Nota: En el siguiente codigo hay cuatro lineas que deben corregirse para que las tres pruebas sean superadas """ class Stack: def __init__(self, initial_items=[]): self.items = initial_items def shift(self): ...
false
c0d1f2201c3dc6a715ba9994214db7c1d535b453
cpvp20/bubblesort
/del.py
378
4.21875
4
def sortit(numbers): for i in range(len(numbers)): if i[1]>i[2]: i[1],i[2]=i[2],i[1] return(numbers) #ACTIAL CODE x=list(input("type some integers randomly, separating them with spaces ")) #creates a list with the numbers the user gives y=[int(i) for i in range(len(x))]#turns list ...
true
622f93ea01a437ead0616c01901d593092a26927
rwaidaAlmehanni/python_course
/get_started/Comprehensions/problem28.py
218
4.21875
4
#Write a function enumerate that takes a list and returns a list of tuples containing (index,item) for each item in the list. def enumerate(array): print [(array.index(y),y) for y in array] enumerate(["a", "b", "c"])
true
28a6f77cddab8da561601b8f743f57d2e1da03bf
Nzembi123/function.py
/functions.py
2,647
4.3125
4
#Function is a block of code that runs only when called def adding(num1, num2): x = num1+num2 print(x) adding(2,4) #Multiplication def multiplication(): num1 =15 num2 =30 sum = num2*num1 print(sum) multiplication() ##arguments def courses(*args): for subject in args: print(sub...
true
e214ac661d060b1ce887b15ad66ff44caac1947c
jubic/RP-Misc
/System Scripting/Problem15/6P/t50_xml1.py
1,763
4.21875
4
""" h2. XML from List of Dictionary Create a function @xmlFromList@ that takes a list of dictionaries. The XML must have the root tag @<storage>@. Each item in the dictionary should be put inside the @<container>@ tag. The dictionary can contain any keys (just make sure the keys are the same for all of the dictionar...
true
4a2ce6635442bfaf8555a1958b6dd06b1389d52d
jubic/RP-Misc
/System Scripting/Problem15/t40_db1.py
1,533
4.53125
5
""" h2. Putting Data into SQLite Database Write a function @putData@ that takes 4 arguments as specified below: # @dbname@ - a string that specifies the location of the database name # @fnames@ - the list of first names # @lnames@ - the list of last names corresponding to the first names list # @ages@ - the list of...
true
8ac8ef9b63495ec2678dbad87faa668c9d4d9924
jubic/RP-Misc
/System Scripting/Problem15/t02_list3.py
665
4.21875
4
""" h2. Zip Two Lists into One Write a function @zipper@ that takes 2 arguments. Both arguments are lists of integers. The function must then create a new list to put the first item of the first list, followed by the first item of the second list. Then second item of the first list, followed by the second item in the...
true
4c4bb3ad3c2b0a45b1b044891d10805fccabb614
Montanaz0r/Skychallenge-Chapter_II
/I_write_my_programs_in_JSON/I_write_my_programs_in_JSON.py
629
4.25
4
import re def sum_the_numbers(filename): """ A function that sum up all the numbers encountered in the file :param filename: name of the file (str) :return: sum of all numbers (int) """ with open(f'{filename}.txt', 'r') as file: data = file.read() results = re.findall(...
true
beaaff1569c17464bb006805d7f2f20ae0b7457a
SpikyClip/rosalind-solutions
/bioinformatics_stronghold/FIB_rabbits_and_recurrence_relations.py
2,483
4.40625
4
# url: http://rosalind.info/problems/fib/ # Problem # A sequence is an ordered collection of objects (usually numbers), which # are allowed to repeat. Sequences can be finite or infinite. Two examples # are the finite sequence (π,−2–√,0,π) and the infinite sequence of odd # numbers (1,3,5,7,9,…). We use the notatio...
true
e8bcb65bd9bb11fd4a11c030c0885dda1669c43b
SpikyClip/rosalind-solutions
/bioinformatics_stronghold/MRNA_inferring_mRNA_from_protein.py
2,808
4.28125
4
# url: http://rosalind.info/problems/mrna/ # Problem # For positive integers a and n, a modulo n (written amodn in shorthand) # is the remainder when a is divided by n. For example, 29mod11=7 # because 29=11×2+7. # Modular arithmetic is the study of addition, subtraction, multiplication, # and division with respect ...
true
1e0382442c4c5c2c87899e2084d88182bf589c11
VIncentTetteh/Python-programming-basics
/my_math.py
868
4.125
4
import math def calculate(enter, number1, number2): print("choose from the list.") print(" 1. ADD \n 2. SUBTRACT \n 3. MULTIPLY") if enter == "add" or enter == "ADD": #number1 = input("enter first number ") #number2 = int(input(" enter second number ")) answer = number1 + number2 ...
true
9e3dbf46dc181a269216335c10726a82d1ad659f
to-yuki/pythonLab-v3
/ans/4/Calculation.py
324
4.375
4
#-- Calc Function --# def calc(val1,operator,val2): if operator == '+': return val1 + val2 elif operator == '-': return val1 - val2 elif operator == '*': return val1 * val2 elif operator == '/': return val1 / val2 else: raise ArithmeticError("Operator Err...
false
95a29801463084c4374fa418b437e2b79719c702
Aparna9876/cptask
/task9.py
201
4.28125
4
odd = 0 even = 0 for i in (5,6,8,9,2,3,7,1): if i % 2 == 0: even = even+1 else: odd = odd+1 print("Number of even numbers: ",even) print("Number of odd numbers: ",odd)
true
661875f584581198453a3ba706a8dd24f2c71430
erchiragkhurana/Automation1
/Python_Practice/Loops/WhileLoop.py
362
4.15625
4
#Initialization, condition then increment #while loop with increment, while loop is also called indefinte loop number = input("Write your number") i=1 while(i<=10): print(int(number)*i) i = i + 1 #while loop with decrement number = input ("your num") i=10 while(i>=1): print(int(number)*i) i=i-2 #another...
true
61d72a38fbeda9f07c9e3847e50dd85737c94f53
erchiragkhurana/Automation1
/Python_Practice/Handling/Condition_Handling.py
1,511
4.46875
4
# take a number from user to check condition handling using if and else x = input("Hey User type your number") if(int(x)==100): print("Number is Greater") else: print("Number is smaller") if(int(x)>100): print("Number is Greater") else: print("Number is smaller") #check multiple condition handling ...
true
4aba95f8d59bec6b7be786522f62bcc98b8ca04f
tranhd95/euler
/1.py
367
4.28125
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. Find the sum of all the multiples of 3 or 5 below 1000. """ multiplies_of_three = set(range(0, 1000, 3)) multiplies_of_five = set(range(0, 1000, 5)) multiplies = multiplies_of_three.un...
true
e4a0c67027e213cf03f165c2ccd6b1ccc6c05ba6
snirsh/intro2cs
/ex2/largest_and_smallest.py
1,261
4.4375
4
###################################################################### # FILE : largest_and_smallest.py # # WRITER : Snir Sharristh , snirsh , 305500001 # # EXERCISE : intro2cs ex2 2015-2016 # # DESCRIPTION: The code below calcul...
true
4078dfbb0fa06a2375d323e747edf7bd4aae9d4a
danschae/Python-Tutorial
/introduction/basics.py
757
4.1875
4
""" This section is more just about very basic programming, i'm not putting too much effort into it. This type of information is universal to most programming languages. """ print("hello world") # simple console log print (5 * 7) print("hello" + " world") # can concatante strings just like in javascript # greetings...
true
b3299f6e5d300404892111647477ef82d30dfb1b
Rohit102497/Command_Line_Utility
/web_crawler/links_from_html.py
1,657
4.15625
4
''' This script prompts a user to pass website url and the html code in string format and output all the links present in the html in a set. ''' import re HREF_REGEX = r""" href # Matches href command \s* # Matches 0 or more white spaces = \s* # Matches 0 or more w...
true
4b44a37b5d556ce1f5d4e00969f0554858064091
juann2563/curso_python
/main.py
1,316
4.125
4
# tipos de datos y condiciones anidadas """ x =float(input("Ingrese dato: ")) #print(x) y= float(input("Ingrese dato: ")) print(10%2) a = True b = False print(a) """ """ a = 5 if a<4: print("hola") print("mundo") elif a<5: print("es menor que 5") else: print("No es menor") """ # condiciones multiples ""...
false
491fefbcbebbbe83f59f94b792b123bd2d0a5e0a
Madhu13d/GITDemo
/PythonBasics1/List.py
1,217
4.5
4
values = [1, 2, "Sai", 4, 5] print(values[0]) # prints 1 print(values[3]) # prints 4 print(values[-1]) # -1 refers to the last element in the list, prints 5 print(values[1:3])#[1:3] is used to get substring.it will fetch 2 values leaving the 3rd index, prints 2, Sai values.insert(3, "Ramana") # will insert Ramana at 3r...
true
1bdc93f3380c0678b115f7c7ee4d0a556a46e0e8
dsplaymaxxis/4linux-teste
/aula2/aula2 ex1.py
673
4.21875
4
#!/usr/bin/python3 #alterar vogais por asterisco #jeito 1 palavra = input('Digite Palavra: ') vogais = 'aeiou' troca = '' for k in palavra: if k in vogais: troca += '*' else: troca += k print(troca) exit() #jeito 2 vogais = 'aeiouAEIOUáéíóúÂÊÎÔÛ' palavra = input('Digite Palavra: ') for k in palavra: if ...
false
f88a428b294348655fba37c81c51cce6976e75aa
RumorsHackerSchool/PythonChallengesSolutions
/Guy/hackerrank.com/Python_Division.py
596
4.15625
4
''' Task Read two integers and print two lines. The first line should contain integer division, // . The second line should contain float division, / . You don't need to perform any rounding or formatting operations. Input Format The first line contains the first integer, . The second line contains the second integ...
true
edcc1681efd32fb99d9c6e3ad28109cc9073e54e
tahniyat-nisar/if_else
/comparing ages.py
606
4.125
4
aryan=int(input("enter the age of aryan:")) arjun=int(input("enter the age of arjun:")) arav=int(input("enter the age of arav:")) if (aryan<(arjun and arav)) and ((arjun and arav)>aryan) : print("aryan is younger brother of arjun and arav\narjun and arav are elder brothers of aryan") elif (arjun<aryan and arav) and...
false
88178fe718a377817fbc9100a5d790ba5ca2798a
tahniyat-nisar/if_else
/based on age and gender wages.py
356
4.15625
4
age=int(input("enter age upto 40 only:")) gender=(input("enter as M for male and F for female:")) if age>=18 and age<30: if gender=="M": print("wage/day=700") elif gender=="F": print("wage/day=750") elif age>=30 and age<=40: if gender=="M": print("wage/day=800") elif gender=="F...
false
995a1bbf95d98be9fd0ad66d4ffdbef299e9b78d
sudharkj/ml_scripts
/regression/regression_template.py
1,426
4.125
4
# From the course: Machine Learning A-Z™: Hands-On Python & R In Data Science # https://www.udemy.com/machinelearning/ # dataset: https://www.superdatascience.com/machine-learning/ # Import the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Import the dataset dataset = pd.read_csv(...
true
d73be7748c66e2a6d3a50c8d884b4e713dc1b92d
sudharkj/ml_scripts
/regression/simple_linear_regression.py
1,252
4.34375
4
# From the course: Machine Learning A-Z™: Hands-On Python & R In Data Science # https://www.udemy.com/machinelearning/ # dataset: https://www.superdatascience.com/machine-learning/ # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.rea...
true
3e8b56b106e9a5172de1592b9669bb35303af4a6
Vaild/python-learn
/teacher_cade/day19/9.next和iter的迭代器.py
1,004
4.21875
4
#!/usr/bin/python3 # coding=utf-8 from collections.abc import Iterator class MyIterator(): """自定义的供上面可迭代对象使用的一个迭代器""" def __init__(self): self.mylist = [] # current用来记录当前访问到的位置 self.current = 0 def add(self, val): self.mylist.append(val) # 调用next方法时,其实就是执行__next__ ...
false
c5cc75fe885f14f205e2b0db8255ef3c580f0684
Vaild/python-learn
/teacher_cade/day19/7.对象可迭代的.py
533
4.3125
4
#!/usr/bin/python3 # coding=utf-8 class MyList(object): def __init__(self): self.container = [] def add(self, item): self.container.append(item) # 对象就是可迭代的 def __iter__(self): return iter(self.container) mylist = MyList() mylist.add(1) mylist.add(2) mylist.add(3) for num in ...
true
307cd2f8ccdcf9abd2e077ed313a81e7cd574989
Yuanchao07/100day
/which_days.py
561
4.34375
4
def is_leap_year(year): return year % 4 == 0 and year != 100 or year % 400 == 0 def which_day(year, month, day): days_of_month = [ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ] days = days_of_month[is_leap_year(year)] total = 0 ...
false
1e252b0287dd1146885882d9443fa506a41cdfc6
chris-miklas/Python
/Lab01/reverse.py
269
4.1875
4
#!/usr/bin/env python3 """ Print out arguments in reverse order. """ import sys def reverse(): """ Printing arguments in reverse order. """ for i in range(len(sys.argv)-1, 0, -1): print(sys.argv[i]) if __name__ == "__main__": reverse()
true
86ffb3138d8eb92b4fb9d7834b8411a9e77e1b57
leoswaldo/acm.tju
/2968_Find-the-Diagonal/find_the_diagonal.py
1,969
4.4375
4
#!/python3/bin/python3 # A square matrix contains equal number of rows and columns. If the order of # the matrix is known it can be calculated as in the following format: # Order: 3 # 1 2 3 # 4 5 6 # 7 8 9 # Order: 5 # 1 2 3 4 5 # 6 7 8 9 10 # 11 12 13 ...
true
24d17e612bfc874dc12d9e3c03d8eb020bf9158a
RanjaniMK/Python-DataScience_Essentials
/creating_a_set_from_a_list.py
250
4.34375
4
# Trying to create a set from a list # 1. create a list # 2. create a set my_list = [1,2,3,4,5] my_set = set(my_list) print(my_set) #Note: The list has square brackets # The output of a set has curly braces. Like below: # {1, 2, 3, 4, 5}
true
5c05985b4974bd8282c20678ff326cf61407b99e
VictorTruong93/dictionary_exercises_python
/dictionary_recap.py
839
4.40625
4
# Dictionaries aka # Hashes, HashMap, HashTables, Object, Map # places = { # 'farm burger': '1234 piedmont, atlanta', # 'naan stop': '12345 piedmont, atlanta', # } # what is the address of farm burger? # print(places['farm burger']) friends = { 'Europe':{ 'Paris': ['Frankie','Grace'], ...
false
0d55e9a32e80e3bf70ef0534f9f8bda1cec61684
gjwlsdnr0115/Computer_Programming_Homework
/lab5_2015198005/lab5_p1.py
431
4.28125
4
# initialize largest number variable largest_num = 0 # variable to stop while loop more = True while(more): num = float(input('Enter a number: ')) if(num > largest_num) : largest_num = num if(num == 0): more = False if(largest_num > 0): # if there was a positive number input print('...
true
cca53fa2eae57d9c6a933cb4130a475c8cf3187c
gjwlsdnr0115/Computer_Programming_Homework
/lab2_2015198005/lab2_p5.py
246
4.375
4
print('This program will convert degrees Celsius to degrees Fahrenheit') celsius = float(input('Enter degrees Celsius: ')) fahren = celsius * 9/5 + 32 print(celsius, 'degrees Celsius equals', format(fahren, '.1f'), 'degrees Fahrenheit')
false
069739315c2e7c0c2a2f8e62fb2f4338cb767650
grahamh21/Python-Crash-Course
/Chapter 4/Try_it_yourself_chapter_4_2.py
1,560
4.34375
4
#Try_it_yourself 4-7 print('Try it yourself 4-7') threes = list(range(3,31,3)) for three in threes: print(three) #Try_it_yourself 4-8 print('Try it yourself 4-8\n') cubes = [] for cube in range(1,11): cubes.append(cube**3) print(cubes) #Try_it_yourself 4-9 print('Try it yourself 4-9') #list c...
true
e21813eeb1869e5f1776dc82d68f08b17a02c9af
grahamh21/Python-Crash-Course
/Chapter 9/dog.py
821
4.1875
4
class Dog(): '''Simple dog class''' def __init__(self, name, age): '''Initialize name and age attributes''' self.name = name self.age = age def sit(self): '''simulate a dog sitting in response to a command''' print(self.name.title() + ' is now ...
false
e22b71585457b49b0e2a9c4525ce003b9c84ed76
grahamh21/Python-Crash-Course
/Chapter 9/Try_it_yourself_Chapter_9_Part_6.py
2,010
4.34375
4
#Try it yourself 9-8: Privileges class User(): '''A way to model a user''' def __init__(self, first_name, last_name, job, birth_month, birth_year): self.first_name = first_name self.last_name = last_name self.job = job self.birth_month = birth_month self.b...
false
2ecb0b4693bdf1151e12e928a88c8daed10cb93e
IagoFrancisco22/listaDeExerciciosPython
/Quarta lista de exercicios Python/exercicio4.py
1,395
4.34375
4
import os print(''' Seja o statement sobre diversidade: “The Python Software Foundation and the global Python community welcome and encourage participation by everyone. Our community is based on mutual respect, tolerance, and encouragement, and we are working to help each other live up to these principles. We want...
false
38c726a507f57fe39460d94ae50a9fb214de35b8
IagoFrancisco22/listaDeExerciciosPython
/Primeira lista de exercicios Python/exercicio8.py
277
4.15625
4
#enunciado print('''Converta uma temperatura digitada em Fahrenheit para Celsius.''') f=int(input("Digite o valor da temperatura em Fahrenheit:")) #temperatura em celsius C = ((f-32)/9)*5#conversao para celsius (F = 9*C/5 + 32) print("A temperatura e de",C,"Celsius")
false
4cfe68342c6d0ce20d2a7657ca106b29259b3345
Akshat111999/Python
/problem03.py
476
4.15625
4
#take a list say adhoc=[1,2,3,1,4,5,66,22,2,6,0,9] #write the program that will do #i) print only those numbers greater than 5 #ii) also print those numbers those are less than or equals to 2 ( <= 2 ) #iii) store these answers in in two different list also adhoc = [1,2,3,1,4,5,66,22,2,6,0,9] for i in a...
false
d755294e211e66c44e04c990d383650b061d087c
ly21st/my-algorithm
/python-vsc/geekbangtrain/week01/1c/1c_python.py
2,222
4.21875
4
# 1 Python是一门简洁的语言 int temp = var1 ; var1 = var2 ; var2 = temp ; var2, var1 = var1, var2 # 2 所有语言的开头 Hello world print('Hello, World') # 3 Python可交互可字节码 >>> x = 1 >>> help(x) >>> dir() >>> exit() # 4 内置数据类型 数值 布尔 字符串 列表、元组、字典、集合 # 4.1 数值常见有 整数、浮点数、复数、布尔值 整数 1 -5 100 8888 整数没有大小限制,受限于内存 浮点数 2.5 4.8 复数 1+2...
false
d758a3f7db1391f62de60fafdb8396d8977f1e70
sudheer-sanagala/edx-python-course
/WEEK-01/square_of_numbers.py
522
4.125
4
""" Square of a given number ex: 3^2 = 3*3 = 9; 5^2 = 5*5 = 25 """ # using while-loop x = 4 ans = 0 itersLeft = x # no of iterations remaining while(itersLeft != 0): # while no of iterations not equal to 0 ans = ans + x # add the same number by itself for thje total no of loops itersLeft = itersLeft - ...
true
1c6a01ffad2fabee405191e2e4d6e5a6f094d55f
meltedfork/Python-1
/Python Assignments/Bike_Assignment/bike.py
890
4.21875
4
class bike(object): def __init__(self,price, max_speed,miles = 0): self.price = price self.max_speed = max_speed self.miles = miles def displayInfo(self): print self.price,self.max_speed,self.miles return self def ride(self): print "Riding..." sel...
true
aa894da9a10e60a2de42056c4c9be3733f1631fb
meltedfork/Python-1
/Python Assignments/dictionary_basics/dictionary_basics.py
287
4.15625
4
def my_dict(): about = { "Name": "Nick", "Age": "31", "Country of birth": "United States", "Favorite Language": "Italian" } # print about.items() for key,data in about.iteritems(): print "My", key, "is", data my_dict()
true
3bed285f835cc5e500ae14e0daaa9d738a53efcf
TamizhselvanR/TCS
/alternative_series.py
967
4.25
4
''' For Example, consider the given series: 1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, … This series is a mixture of 2 series – all the odd terms in this series form a Fibonacci series and all the even terms are the prime numbers in ascending order. Now write a program to find the Nth term in this series. ''' d...
true
7d6a397767236554fe50d29a043682d9ac471a6c
ddilarakarakas/Introduction-to-Algorithms-and-Design
/HW3/q4.py
1,373
4.21875
4
import random swap_quicksort=0 swap_insertion=0 def quick_sort(array, low, high): if low<high: pivot = rearrange(array, low, high) quick_sort(array, low, pivot - 1) quick_sort(array, pivot + 1, high) def rearrange(array,low,high): global swap_quicksort p = array[high] left = l...
true
42d6ade9eec3f1abb794bf4f544026fb83451bfe
JuanDiazUPB/LogicaProgramacionUPB
/Laboratorios/Lab1604/Ejercicio 1.py
470
4.1875
4
def validacion(email): for x in email: if direccion.endswith("@gmail.com") or direccion.endswith("@hotmail.com") or direccion.endswith("@outlook.com"): # endswith valida la ultima parte de la cadena return True return False direccion = input("Ingresa tu email: ") if va...
false
fa6192cee5ee11b819b8037ad641333ded8f9422
Bpara001/Python_Assgn
/03 Functions/varargs_start.py
445
4.1875
4
# Demonstrate the use of variable argument lists # TODO: define a function that takes variable arguments def addition(*args): result = 0 for arg in args: result +=arg return result def main(): # TODO: pass different arguments print(addition(5,10,20,30)) print(addition(1,2,3)) # T...
true
504e64c3d0be1d03c044c54594c9af6785539da2
samsnarrl22/Beginner-Projects
/Song Variables.py
1,116
4.28125
4
# Storing attributes about a song in Variables # First create variables for each of the characteristics that make up a song title = "Ring of Fire" artist = "Jonny Cash" # These variables are strings which can be seen due to the "" album = "The Best of Johnny Cash" genre = "Country" time_in_seconds = 163 # time_in_se...
true
984863b3ccb43eb11025cd1aae499deee7d6acec
sicp/ikoma-sicp
/oza/2/2-17,23.py
1,132
4.125
4
# last_pair #class mytuple: # # def __init__(self, t): # self.tpl = t # # def car(self): # return self.tpl[0] # # def cdr(self): # return self.tpl[1:] # # def last_pair(self): # # return (self.tpl(-1),) # l = len(self.tpl) # return (self.tpl[l-1],) # # def __str__(self): # return str(self.tpl) # #t = mytuple((...
false
5656d54460e0742abd2340bbcd6e61024858e0d7
Zaliann/practice
/практика 2/lab2-2.py
1,023
4.4375
4
# Целые числа и числа с плавающей точкой являются одними из самых распространенных в языке Python number = 9 print(type(number)) # Вывод типа переменной number float_number = 9.0 # Создайте ещё несколько переменных разных типов и осуществите вывод их типов lenn = 2.4 snake = 4 stroch = "Площадь - произведение дли...
false
fe7e22bfd1dac7b4c1bf88c09e7cf02eed311563
Andresdamelio/master-python
/08 - Funcionalidades avanzadas/funcion-map.py
1,707
4.15625
4
# encoding: utf-8 """ ============================================================================================== FUNCION MAP ============================================================================================== """ # Trabaja de forma similar a filter, a diferencia de que en lu...
false
f66969d71e58004f000e966988c4ec81dd9679ad
Andresdamelio/master-python
/08 - Funcionalidades avanzadas/funcion-filter.py
1,828
4.5
4
# encoding: utf-8 """ ============================================================================================== FUNCION FILTER ============================================================================================== """ # Tal como su nombre lo indica su funcion es filtrar, a par...
false
80ff22bf321c958b2b71b97a0c2eada9d23a9bf3
Andresdamelio/master-python
/02 - Entrada y salida/salida.py
2,950
4.125
4
""" ====================================================================== Salida de datos ====================================================================== """ v = "otro texto" n = 10 print("un texto", v, "y un numero", n) # Para evitar escribir muchos print, e ir colocando variables separadas por una com...
false
b6a30271fa2adfcb89ae1b1fb658fdeae0dce67c
Andresdamelio/master-python
/08 - Funcionalidades avanzadas/compresion-listas.py
2,669
4.5625
5
# COMPRESION DE LISTAS # Es una forma de optimizar las lineas de codigo al crear una lista de elementos ''' ====================================================================================================== CREANDO UNA LISTA CON LAS LETRAS DE UNA PALABRA ================================...
false
88812cfba755cc4b06a8724ea3def8d51f18dd68
JinHoChoi0104/Python_Study
/Inflearn/chapter05_02.py
850
4.21875
4
# Chapter05-02 # 파이썬 사용자 입력 # Input 사용법 # 기본 타입(str) # ex1 # name = input("Enter Your Name: ") # grade = input("Enter Your Grade: ") # company = input("Enter Your Company name: ") # print(name, grade, company) # ex2 # number = input("Enter number: ") # name = input("Enter name: ") # print("type of number", type(num...
true
df3b1b911ee16292a1cf94b1c9523c4b0ee2698a
Himanshuhub/Python
/python_fundamentals/Assignment-MultiplesSumAverage.py
299
4.15625
4
# Assignment: Multiples, Sum, Average # Multiples # Part 1 # for count in range(1,1000,2): # print count # Part 2 # for count in range(5,1000005, 5): # print count # Sum List list = [1, 2, 5, 10, 255, 3] print sum(list) # Average List a = [1, 2, 5, 10, 255, 3] print sum(a)/len(a)
false
9eb1e8456b09fc34a2d11c5c41c63d85704cc70c
JoyP7/BasicPythonProjects
/rock_paper_scissors.py
1,408
4.28125
4
from random import randint #create a list of play options t = ["Rock", "Paper", "Scissors"] #assign a random play to the computer computer = t[randint(0,2)] #set player to False player = False p_score = 0 c_score = 0 #here is the game while player == False: #case of Tie player = input("Rock, Paper, or Sciss...
true
5ee2bde50b9cf56e40ca8bc146dd6085eba343d5
YunfeiZHAO/leetcode
/old/binary.py
897
4.21875
4
from typing import List def hammingDistance(x: int, y: int) -> int: ''' The Hamming distance between two integers is the number of positions at which the corresponding bits are different. ''' def DtoB(x: int) -> List[int]: L = [0] * 31 i = 0 while x != 0: L[30 - i] ...
false
b0652b6f3148c4213d754423c27d40276ef4baab
ddtriz/Python-Classes-Tutorial
/main.py
1,223
4.375
4
#BASIC KNOWLDEGE ABOUT CLASSES #What is a class? class firstClass():#Determine a class in the code by using [class] name = "" identification = 0 print ("hello") firstClass.name = "John" firstClass.identification = 326536123 #If you print the firstClass you'll get something like <class '__main__.firstCla...
true
f7f462a0cc00c3d68b8d0a5bd282151eea24fb9a
ECastro10/Assignments
/rock_paper_scissors_looped.py
2,085
4.125
4
#import random and computer signs list import random signchoices = ["rock", "paper", "scissors"] player1_score = 0 comp_score = 0 game = 0 while game < 3: hand1 = input("Enter rock, paper, or scissors Player1 > ").lower() compSign = random.choice(signchoices) print("Computer chooses " + compSign) i...
true
1432bcab9faa357c76e538108162711cc296a9aa
Charlesyyun/leetcode
/剑指 Offer 28. 对称的二叉树.py
1,570
4.1875
4
''' 剑指 Offer 28. 对称的二叉树 请实现一个函数,用来判断一棵二叉树是不是对称的。如果一棵二叉树和它的镜像一样,那么它是对称的。 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。     1    / \   2   2  / \ / \ 3  4 4  3 但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:     1    / \   2   2    \   \    3    3   示例 1: 输入:root = [1,2,2,3,4,4,3] 输出:true 示例 2: 输入:root = [1,2,2,n...
false
695c5ac1414507b89920128ef98b87aadf843f17
TarunVenkataRamesh-0515/python-515
/setop.py
971
4.15625
4
#set operations set1={1,2,3,4,5,10,12,13} set2={10,11,12,13,14,15,17,19,1} s1={1,2,3,4,5,10,12,13} s2={10,11,12,13,14,15,17,19,1} a={1,2,3,4,5,10,12,13} b={10,11,12,13,14,15,17,19,1} #union()-->All the elements,returns the union as a new set u=set1.union(set2) print("union",u) #union and update """ in update union of ...
false
150747e7e7b6a368e0ac7af28d4a4d10358acdbb
mohitsharma2/Python
/Book_program/max_using_if.py
413
4.59375
5
# Program to accept three integers and print the largest of the three.Make use of only if statement. x=float(input("Enter First number:")) y=float(input("Enter Second number:")) z=float(input("Enter Third number:")) max=x if y>max: max=y if z >max: max=z print("Largest number is:",max) """ output===> Ent...
true
d2db2c0608a6ad6ca1f9c423c55ec4aeffef3939
mohitsharma2/Python
/Book_program/divisor.py
1,068
4.28125
4
#program to find the multiles of a number(divisor) out of given five number. print("Enter the five number below") num1=float(input("Enter first number:")) num2=float(input("Enter second number:")) num3=float(input("Enter third number:")) num4=float(input("Enter fourth number:")) num5=float(input("Enter fifth...
true
e8fc3a72648cfd8d9b857012a27031e7a08b8357
mohitsharma2/Python
/Blackjack.py
1,629
4.3125
4
""" Name: Blackjack Filename: Blackjack.py Problem Statement: Play a game that draws two random cards. The player then decides to draw or stick. If the score goes over 21 the player loses (goes ‘bust’). Keep drawing until the player sticks. After the player sticks draw two computer...
true
3817d594c6261e8d7a51bd820a4c0ed2bfe36dd0
mohitsharma2/Python
/Book_program/sqrt.py
930
4.25
4
# program to calculate and print roots of a quadratic equcation : ax^2 + bx + c=0 (a!=0) import math print("for quadratic equcation : ax^2 + bx + c=0,enter cofficient below:") a=int(input("Enter a:")) b=int(input("Enter b:")) c=int(input("Enter c:")) if a==0: print("Value of 'a' should not be zero.") prin...
true
0f1f74514cd78b6f952e24f923975d82a18e1260
mohitsharma2/Python
/Book_program/identify_character.py
474
4.3125
4
""" program to print whether a given character is an uppercase or a lowercase character or a digit or any other special character. """ inp1=input("Enter the Character:") if inp1>='A' and inp1<="Z" : print("You entered upper case character.") elif inp1>='a' and inp1<='z' : print("You entered lower case c...
true
260ea2d6275282bb8ecc34d2488bbdca52459a45
mohitsharma2/Python
/gravity_cal.py
224
4.21875
4
# Gravity Calculator Acceleration=float(input('enter the Acceleration in m/s^2')) Time=float(input('enter the time in seconds ')) distance=(Acceleration*Time*Time )/ 2 print('object after falling for 10 seconds=',distance)
true
2c894119b5321d953fa1346d722d42f190de8c38
alexdavidkim/Python3-Notes
/numeric_types/booleans.py
2,949
4.53125
5
# All objects in Python have a Truthyness or Falsyness. All objects are True except: # None # False # 0 # Empty sequences (list, tuple, string, etc) # Empty mapping types (dictionary, set, etc) # Custom classes that implement a __bool__ or __len__ that returns False or 0 # Therefore, every built...
true
31981e806a88845bb143f49d24aaab942b79b990
alexdavidkim/Python3-Notes
/modules_packages/datetime_pytz.py
1,914
4.34375
4
# https://howchoo.com/g/ywi5m2vkodk/working-with-datetime-objects-and-timezones-in-python import datetime import pytz from pprint import pprint # -------------- Dates ------------------- dean_birthday = datetime.date(2017, 5, 30) # print(specific_date) today = datetime.date.today() # print(t...
false
30ab4a544a884fa139bbbe3c31e9286cccfc3ced
13424010187/python
/LearnPython3-master/10-range()的使用/test.py
634
4.28125
4
# 使用range()函数 # for val in range(5): # print(val) # for(int i = 0; i < 5; i++) { # } # 指定range()的范围 # for val in range(1, 5): # print(val) # for(int i = 1; i < 5; i++) { # } # 生成数组 # nums = list(range(1,5)) # print(range(1,5)) # print(nums) # 奇数数组 # nums = list(range(1,11,2)) # print(nums) # 偶数数组 # nums = l...
false
d84fa31140a19d15dfd356bed0654068237b7be0
13424010187/python
/源码/10-诡秘的数字巧合/练习1成果包——水仙花数v1.0.py
1,012
4.15625
4
'''练习1成果包——水仙花数v1.0''' ''' 编写程序帮助阿短来判定一个三位整数是否为水仙花数。 输入一个三位整数,输出是否为水仙花数提示信息。 如: Input: 输入数字:123 Output: 123 不是水仙花数 ''' #判断一个数是不是水仙花数 num = int(input('输入数字:')) number= str(num) i = 0 # 循环计数器 daffodil = 0 # 用和原数number来对比的水仙花数 #主循环 while i < len(number): daffodil += int(number[i]) ** 3 i += 1 if int(number) ==...
false
629d204d76e6545d713ec221aebff2c8bd627a6a
cstarr7/daily_programmer
/hard_2.py
1,852
4.28125
4
# -*- coding: utf-8 -*- # @Author: Charles Starr # @Date: 2016-03-08 23:51:13 # @Last Modified by: Charles Starr # @Last Modified time: 2016-03-09 00:14:55 #Your mission is to create a stopwatch program. #this program should have start, stop, and lap options, #and it should write out to a file to be viewed later...
true
a388858021542a586073ae6f0cea563423bedd17
cstarr7/daily_programmer
/easy_267.py
1,223
4.28125
4
# -*- coding: utf-8 -*- # @Author: Charles Starr # @Date: 2016-07-06 23:20:28 # @Last Modified by: Charles Starr # @Last Modified time: 2016-07-06 23:53:49 #https://www.reddit.com/r/dailyprogrammer/comments/4jom3a/20160516_challenge_267_easy_all_the_places_your/ def input_place(): #ask user what place their dog ...
true
34409c67de5b24a50987e1a86be10ec2e9c299ae
suryanisaac/mathwithcode
/Math_With_Code/Triplet.py
449
4.3125
4
# Program to find if a given set of numbers are pythagorean triplets num1 = int(input("Enter The Largest Number: ")) num2 = int(input("Enter The Second Number: ")) num3 = int(input("Enter The Third Number: ")) pt = True n1s = num1 * num1 n2s = num2 * num2 n3s = num3 * num3 if (n1s == n2s + n3s): pt = True ...
false
bcdf93ea36a3afa6632324742bf0b9acae82a7ef
nguyent57/Algorithms-Summer-Review
/square_root_of_int.py
1,388
4.28125
4
def square_root(x): # BASE CASE WHEN X == 0 OR X == 1, JUST RETURN X if (x == 0 or x == 1): return(x) # STARTING VALUE FROM 2 SINCE WE ALREADY CHECKED FOR BASE CASE i = 2 # PERFECT SQUARE IS THE SQUARE NUMBER ON THE RIGHT OF THE GIVEN NUMBER # SAY, WE HAVE 7 -> PERSQUARE IS 9, 3 P...
true
fd525d79b0b9b683440ef6e52a268feb1550e4e3
nguyent57/Algorithms-Summer-Review
/shortest_palindrome.py
1,682
4.21875
4
# RUN TIME # USE: TAKE THE REVERSE STRING OF THE GIVEN STRING AND BRING IT TO THE END # TO SEE WHAT IS THE SUFFIX OF THE STRING COMPARING TO THE PREFIX OF THE STRING # REMOVE THE SUFFIX --> SHORTEST PALINDROME def palindrom(str): # CREATE AN EMPTY STRING FOR PALINDROME reverse = '' # FOR...
true
7bbe8947b97d2bd27773d003f3b3eedf9eaa712a
nguyent57/Algorithms-Summer-Review
/all_unique_char.py
814
4.25
4
# METHOD 1: USING A FUNCTION # RUN TIME: O(n) # CREATE A FUNCTION THAT WOULD TAKE ANY STRING def all_unique_char(str): # CREATE A DICTIONARY TO STORE THE COUNT OF EACH CHARACTER count = {} # CREATE AN ARRAY TO STORE THE CHAR char = [] # FOR EVERY ITEM IN STRING for i in str: # ...
true
0f6633f03b958e1c606f41ec4c82e660b6dfd350
UdayQxf2/tsqa-basic
/BMI-calculator/03_BMI_calculator.py
2,937
5.125
5
""" We will use this script to learn Python to absolute beginners The script is an example of BMI_Calculator implemented in Python The BMI_Calculator: # Get the weight(Kg) of the user # Get the height(m) of the user # Caculate the BMI using the formula BMI=weight in kg/height in meters*height in me...
true
fba5a5017e2f9b1f5b91a3f877e45a7c63f758eb
UdayQxf2/tsqa-basic
/BMI-calculator/02_BMI_calculator.py
1,797
5.09375
5
""" We will use this script to learn Python to absolute beginners The script is an example of BMI_Calculator implemented in Python The BMI_Calculator: # Get the weight(Kg) of the user # Get the height(m) of the user # Caculate the BMI using the formula BMI=weight in kg/height in meters*height in me...
true
bd1268244c535712fa6616edbf7b2a015867b30e
mikephys8/The_Fundamentals_pythonBasic
/week7/9-1.py
1,005
4.1875
4
__author__ = 'Administrator' tup = ('a', 3, -0.2) print(tup[0]) print(tup[1]) print(tup[2]) print(tup[-1]) print('-------------') print(tup[:2]) print(tup[1:2]) print(tup[1:3]) print(tup[2:3]) print(tup[2:]) print('-------------') # tuples arer immutable!!cannot be assigned with other # value in opposition with list #...
true
035b6c28e1b373fef200773cdc73a940a98d8f7c
arrpitsharrma/PreCourse_1
/Exercise_4.py
1,528
4.25
4
# Time Complexity : not sure # Space Complexity : not sure # Did this code successfully run on Leetcode : yes # Any problem you faced while coding this : had a hard time dealing with tree, I get stuck when I come across trees and linked list for basic things sometimes # Python program to insert element in binary tree...
true