blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
eb4b36ee61f4541e2334038e366428a3b570d815
sandeepkundala/Python-for-Everybody---Exploring-Data-in-Python-3-Exercise-solutions
/ex7_2.py
1,030
4.1875
4
# Chapter 7 # Exercise 2: Write a program to prompt for a file name, and then read through the # file and look for lines of the form: # X-DSPAM-Confidence:0.8475 # When you encounter a line that starts with “X-DSPAM-Confidence:” pull apart # the line to extract the floating-point number on the line. Count these lines ...
true
eee346b98c2726facf971db72ef2c5d6be0a7ee9
sandeepkundala/Python-for-Everybody---Exploring-Data-in-Python-3-Exercise-solutions
/ex8_4.py
472
4.3125
4
# Chapter 8 # Exercise 4: Write a program to open the file romeo.txt and read it line by line. For each line, # split the line into a list of words using the split function. # For each word, check to see if the word is already in a list. If the word is not in # the list, add it to the list. fh = input('Enter file: ...
true
697a943b2cceb74f2503fd1130bd3fa263ff57cf
Robbot/Teclado
/The Complete Python/Section1/main.py
1,533
4.28125
4
# Coding exercise 2 name = input("What is your name? ") print(f"Hello, {name}") age = int(input("What is your age? ")) print(f"You are {age*12} months old") # Coding exercise 3 nearby_people = {'Rolf', 'Jen', 'Anna'} user_friends = set() #This is an empty set friend = input("What is the name of your friend? ") user_fr...
true
d5b582a3938073bfb5355322b4fe492b41de1d73
johnahnz0rs/CodingDojoAssignments
/python/python_fundamentals/scores_and_grades.py
829
4.3125
4
# 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 - 89; Grade - B # Score: 90 - 100; Grade - A def scor...
true
30ef3b36e9f9dddbf5526b068c1451796e78da89
nd-cse-34872-su21/cse-34872-su21-examples
/lecture02/cheatsheet.py
366
4.25
4
#!/usr/bin/env python3 v = [1, 2, 3] # Create dynamic array v.append(4) # Append to back of array v.insert(0, 0) # Prepend to front of array print(len(v)) # Display number of elements for e in v: # Traverse elements print(e) # Traverse elements with index for...
true
f1705276ec52154591de27009366f0e8c5e278be
anejaprerna19/LearninPython
/passwordchecker.py
396
4.25
4
#Password Checker Assignment from Udemy Course #In this simple assignment, we take user inputs for username and password and then calculate and print the length of password. username= input("What is your username? "); password= input("Enter the password "); pass_length= len(password) hidden_pass= '*' * pass_length pr...
true
839764c040251100e370a5b0f24b8c3e8044961f
dhitalsangharsha/GroupA-Baic
/question5.py
204
4.125
4
'''5) Take an arbitrary input string from user and print it 10 times.''' string=input("enter a string:") print("\nprinting {} 10 times ".format(string)) for i in range(1,11): print(str(i)+':',string)
true
fc46ee5a3d68857277ffca31aa3925943c139988
irffanasiff/100-days-of-python
/day5/range.py
382
4.1875
4
# for number in range(1, 10, 3): # print(number) # total = 0 # for number in range (1, 101): # total += number # print(total) #! sum of all the even numbers from 1 to 100 total =0 for number in range(0,101,2): total += number print(total) #? or total =0 for number in range (1,101): if number%2==0: ...
true
68ceeb0a35ee5de2f89d64d842496f112689b9ed
florinbrd/PY--
/python developer zero to mastery/Practice Exercises - pynative.com/Basic Exercises/Exercise10.py
509
4.15625
4
# Question 10: Given a two list of ints create a third list such that should contain only odd numbers from the first list and even numbers from the second list def odd_list(list1, list2): list3 = [] for item1 in list1: if item1 % 2 == 0: list3.append(item1) for item2 in list2: ...
true
5d2ac7e730a592f9063af6ae5366608611060c67
florinbrd/PY--
/python developer zero to mastery/Practice Exercises - pynative.com/Basic Exercises/Exercise02.py
398
4.3125
4
# Question 3: Accept string from the user and display only those characters which are present at an even index def even_char(string_defined): print(f'Your original string is: {string_defined}') for item in range(0, len(string_defined)-1, 2): if item % 2 == 0: print("index[", item,"]", strin...
true
77f65fd43bd51bc8ae2c59c8342d5798ab8513c0
rgion/Python-P6
/P6E1.py
394
4.25
4
#P6 E1 - rgion #Escribe un programa que te pida palabras y las guarde en una lista. #Para terminar de introducir palabras, simplemente pulsa Enter. #El programa termina escribiendo la lista de palabras. palabra=input("Escribe una palabra: ") lista=[] while (palabra!=""): lista.append(palabra) palabra=input("Esc...
false
8ba15361440b980c27bdc1ddd6c35a554af4f28e
rgion/Python-P6
/P6E11.py
923
4.21875
4
#P6 E11 - rgion #Escribir un programa para jugar a adivinar un número #(el ordenador "piensa" el número y el usuario lo ha de adivinar). #El programa empieza pidiendo entre qué números está el número #a adivinar, se "inventa" un número al azar y luego el usuario #va probando valores. El programa va decidiendo si son de...
false
c55de30866091747d5fcac35734d4c38d0e8154b
khuang7/python3_thehardway
/ex18.py
413
4.125
4
def print_two(*args): arg1, arg2 = args print(f"arg1: {arg1}. arg2: {arg2}") #*args is actually pointless we can just do def print_two_again(arg1, arg2): print(f"arg1: {arg1}, arg2: {arg2}") # this just takes one argument def print_one(arg1): print(f"arg1: {arg1}") def print_none(): print("I got nothin") prin...
false
0669fa9486066c0a53b54f782a5f9d4d0e816264
shashaank-shankar/OFS-Intern-2019
/Python Exercises/Condition Statements and Loops/Exercise 1.py
341
4.25
4
# Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included). input = int(input("Enter a number: ")) if input >= 1500 and input <= 2700: if input%7 == 0: if input%5 == 0: print(input + " is between 1500 and 2700. It is also div...
true
11f50308cb6450ee304af690d61f072c70924277
shashaank-shankar/OFS-Intern-2019
/Python Exercises/Condition Statements and Loops/Exercise 2.py
1,088
4.5
4
# Write a Python program to convert temperatures to and from celsius, fahrenheit. print("\nThis program converts Celsius and Farenheit temperatures.") def tempConvert (type): if type == "C": # convert to C new_temp = (temp_input - 32) * (5/9) new_temp = round(new_temp, 2) print("\n"...
true
54518c4f1dcd313da6458e664f7f8c1fa2b95b5c
Susama91/Project
/W3Source/List/list10.py
273
4.21875
4
#Write a Python program to find the list of words that are longer than n #from a given list of words. def lword(str1,n): x=[] txt=str1.split() for i in txt: if len(i)>n: x.append(i) print(x) lword('python is a open',2)
true
d1573d6ad748eaceb5747f80a42477914ece741b
ItsPepperpot/dice-simulator
/main.py
644
4.1875
4
# Dice rolling simulator. # Made by Oliver Bevan in July 2019. import random def roll_die(number_of_sides): return random.randint(1, number_of_sides) print("Welcome! How many dice would you like to roll?") number_of_dice = int(input()) # TODO: Add type checking. print("Okay, and how many sides would you like t...
true
1f4d2489bcfa31d9c1d3b2e82828c1533fac81d2
MarvvanPal/foundations-sample-website
/covid_full_stack_app/covid_full_stack_app/controllers/database_helpers.py
2,107
4.65625
5
# connect to the database and run some SQL # import the python library for SQLite import sqlite3 # this function will connect you to the database. It will return a tuple # with two elements: # - a "connection" object, which will be necessary to later close the database # - a "cursor" object, which will neccesary t...
true
7e603d0a3d96c50104630187b700ccab8cf035d7
hemang249/py-cheatsheet
/conditions.py
479
4.15625
4
# Common Conditional Statements used in Python 3 # Basic if-else Condition x = 5 if x == 5: print("x = 5") else: print("x != 5") # Basic Logical operations # and or not a = 0 b = 1 boolean = False if a == 0 and b == 1: print("a = 0 and b = 1") if a == 0 or b == 1: print("Either a = 0 or b = 1")...
true
6dea2f8d8f2ae2804961d80bc0c224a174d4694b
zihu/job_interview_code
/lcs.py
866
4.1875
4
#!/usr/bin/python def lcs(xs, ys): '''Return a longest common subsequence of xs and ys. Example >>> lcs("HUMAN", "CHIMPANZEE") ['H', 'M', 'A', 'N'] ''' if xs and ys: xb = xs[:-1] yb = ys[:-1] if xs[-1] == ys[-1]: return lcs(xb, yb) + [xs[-1]] else: return max(lcs(xs, yb...
false
8ad114e4e5f63a56c8d560f60d05e19dcd77ee42
KimberleyLawrence/python
/for_loop_even_numbers.py
245
4.1875
4
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] for number in a: # % 2 == 0 is dividing the number by 2, and seeing if there is any remainders, any remainders mean that the number is not even. if number % 2 == 0: print number
true
efd2607c2b56baeb6866395321d6e2c5906c8b9b
lucasarieiv/Livro-Exercicio-Python
/collatz.py
352
4.15625
4
def collatz(number): if number % 2 == 0: v1 = number // 2 print(v1) return v1 elif number % 2 == 1: v2 = 3 * number + 1 print(v2) return v2 print('Enter number. ') num = input() try: collatz(int(num)) except ValueError: pr...
false
37e9fa37ff5e6cc968b0031e802538c1c902ad9c
Kristy16s/Think-Python-2-Exercises-By-Chapter
/2.1 Exercises.py
1,285
4.4375
4
# 2.10 Exercises # Date 8/4/2021 """ Exercise 1 Repeating my advice from the previous chapter, whenever you learn a new feature, you should try it out in interactive mode and make errors on purpose to see what goes wrong. """ # We’ve seen that n = 42 is legal. What about 42 = n? # 42 = n """ File "<input>", line 1 ...
true
41228a26ab53da47dabc59d4d0414c23e806d902
shanksms/python_cookbook
/iterators-generators/generator-examples.py
1,272
4.6875
5
""" Here’s a generator that produces a range of floating-point numbers. Below function returns a generator object. A generator object is also an iterator. an Iterator is an Iterable. That is why you can use it in while loop. """ def frange(start, stop, increment): i = start while i < stop: yield i ...
true
40a0f176eba2fed30a0c5ed96d9ee6fbe654a70a
ssummun54/wofford_cosc_projects
/Assignments/8and10.py
1,719
4.15625
4
# 8and10.py # This progam runs two functions. The first function uss Newton's Method to find the # square root of a number. The second function creates an acronym based on the phrase # given by the user. #importing math for square root from math import * #function for problem 8 def nextGuess(guess, ne...
true
d92640d7336759a48656c7df4bd333ceecca69aa
ssummun54/wofford_cosc_projects
/Assignments/numerology.py
615
4.4375
4
# numerology.py # This program sums up the Unicode values of the user's full name and displays the corresponding Unicode character # A program by Sergio Sum # 3/24/17 def main(): name = input("Please enter your full name: ") # not counting spaces by turning to list name = name.split() #j...
true
3ed869277d2d7958bc4d4012434c826f03e88eaf
dexterchan/DailyChallenge
/MAR2020/ScheduleTasks.py
648
4.1875
4
#A task is a some work to be done which can be assumed takes 1 unit of time. # Between the same type of tasks you must take at least n units of time before running the same tasks again. #Given a list of tasks (each task will be represented by a string), # and a positive integer n representing the time it takes to ru...
true
d6d4cc0dae2f1a1fc7a650798ee6dad83d6b57ed
dexterchan/DailyChallenge
/NOV2019/WordSearch.py
2,069
4.15625
4
#skills: array traversal #You are given a 2D array of characters, and a target string. Return whether or not the word target word exists in the matrix. # Unlike a standard word search, the word must be either going left-to-right, or top-to-bottom in the matrix. #Example: #[['F', 'A', 'C', 'I'], # ['O', 'B', 'Q', 'P']...
true
e76e31b3bce987ce0ed9b4a39f29ad6eb1221d92
dexterchan/DailyChallenge
/MAR2020/FilterBinaryTreeLeaves.py
2,112
4.15625
4
#Hi, here's your problem today. This problem was recently asked by Twitter: #Given a binary tree and an integer k, filter the binary tree such that its leaves don't contain the value k. Here are the rules: #- If a leaf node has a value of k, remove it. #- If a parent node has a value of k, and all of its children are...
true
54d303d49e8e260e78b3509e332bbe733fb081ff
Liambass/Python-challenges-exercises-and-tutorials
/Exercises/intfloat.py
590
4.1875
4
# Integers and Floats # number1 = input("Enter whole number: ") # number2 = input("Enter decimal number: ") # integer_number = int(number1) # float_number = float(number2) # round_number = int(round(float_number)) # print(number1) # print(number2) # print(round_number) # What will be the output of this code? number...
false
2ea7d16b392e87f58bb97d39e40df65120963c28
JoseCintra/MathAlgorithms
/Algorithms/MatrixDeterminant.py
2,070
4.46875
4
""" Math Algorithms Name: MatrixDeterminant.py Purpose: Calculating the determinant of 3x3 matrices by the Sarrus rule Language: Python Author: José Cintra Year: 2021 Web Site: https://github.com/JoseCintra/MathAlgorithms License: Unlicense, described in http://unlicense.org...
true
7e58a06e5ad508b8d888218256f00a309bdbcd40
XuuRee/python-codecademy
/Unit 00/factorial_p3_mysol.py
331
4.15625
4
# factorial program using Python (my own solution) print("Factorial using Python 3 (my own solution)\n") number = eval(input("Enter a non-negative integer for factorial: ")) factorial = 1 for i in range(1,number + 1): # druha pozice = zadane cislo + jedna factorial = factorial * i print("Result: ",f...
false
c2ffdddf292da3a4fb5e7a66b27b664e52dadd48
pzavisliak/Python
/Circle/Math.py
1,376
4.125
4
import math print("Вычисление длины круга") def bugsa(): if a != "R" or a != "D": print("Нужно было ввести R или D , в следуйщий раз читай внимательнее") exit() a = input("С помощью чего ты хочешь найти длину? Радиус - R, Диаметр - D\n") bugsa() rad = "" diam = "" def bugsradius(): if rad ...
false
1e38cb2f374eede29eaf6520bfb1f97d84a10f6c
TolpaBomjey/GB.Python.HW
/HW2/task2-1.py
558
4.3125
4
# Создать список и заполнить его элементами различных типов данных. # Реализовать скрипт проверки типа данных каждого элемента. # Использовать функцию type() для проверки типа. Элементы списка # можно не запрашивать у пользователя, а указать явно, в программе. someList = ["раз", 2, None, 3.14] for smth in someLi...
false
36f42da49b3aa743cee7722bf0def14fda5c167b
TolpaBomjey/GB.Python.HW
/HW2/task2-4.py
558
4.125
4
# Пользователь вводит строку из нескольких слов, разделённых пробелами. # Вывести каждое слово с новой строки. Строки необходимо пронумеровать. # Если в слово длинное, выводить только первые 10 букв в слове. userFrase = input("Давай вещай. Слова через пробел >>>") words = list(userFrase.split(" ")) for w, el in ...
false
a893cd5e53c840925e54c60af40514bb8fa51d07
mansoniakki/PY
/Reverse_Input_String.py
412
4.40625
4
print("##################This script with reverse the string input by user###########") name=input("Please enter first and last name to reverse: ") print("name: ", name) words=name.split() print("words: ", words) for word in words: lastindex = len(word) -1 print("lastindex ", lastindex) for index in range...
true
63582443b16149b97f551b6a9f80845fa8b60a30
rbenf27/dmaimcoolshek6969
/PYTHON/COLOR GUESSER.py
530
4.125
4
import random color = random.randint(1,7) if color == 1: color = "yellow" if color == 2: color = "green" if color == 3: color = "orange" if color == 4: color = "blue" if color == 5: color = "red" if color == 6: color = "purple" user_choice = input("Choose a c...
true
fc7e5ec06d19b9a4a1398798f589c0982331c192
meloning/pythonSyntaxEx
/chapter9/ObjectEx.py
652
4.15625
4
class BookReader: __country = 'South Korea' def __init__(self, name): self.name = name def read_book(self): print(self.name +' is reading Book!!') def set_country(self, country): self.__country = country def get_country(self): return self.__country reader = BookReade...
false
f31a9a0fe3a3642263c05c365dffa4db220de581
rbrown540/Python_Programs
/Calculate.py
2,967
4.40625
4
# Richard Brown - SDEV 300 # March 16, 2020 # Lab_One - This program prompts the user to select a math function, # then performs that function on two integers values entered by the user. print ('\nWelcome to this awesome Python coded calculator\n') # provide user with the math function options print ('Select 1 for ADD...
true
f366a69f898f1bc46e0495605878eefb3dcb438e
richa18b/Python
/oops.py
2,829
4.15625
4
import random import sys import os class Animal : _name = None #this is equivalent to __name = "" _height = 0 #_ means that it is a private variable _weight = 0 _sound = "" #constructor def __init__(self,name,height,weight,sound): self._name = name self._height = height ...
true
7d6e9b19d7f2ba2da75911fc61a300d39cf1857f
kunlee1111/oop-fundamentals-kunlee1111
/Coin.py
1,790
4.21875
4
""" ------------------------------------------------------------------------------------------------------------------------ Name: Coin.py Purpose: Simulates 1000 flips of a coin, and tracks total count of heads and tails. Author: Lee.K Created: 2018/11/30 ---------------------------------------------------------...
true
df25914cc08c600e8d1e8b80f4e027dbb7640c09
kaurmandeep007/daily-diary
/dictionary.py
868
4.25
4
dict={ "brand":"ford", "model":"mustang", "year":1964 } print(dict) #acess items: x=dict["model"] x=dict.get("model") print(x) #change values: dict["year"]=2014 print(dict) #loop through a dictionary: for x in dict: print(x) #if key exists: if "brand" in dict: print("yes,'b...
false
d64728f99b0089fbca68bdef03db6982d570d8d4
gingij4/Forritun
/bmistudull.py
560
4.53125
5
weight_str = input("Weight (kg): ") # do not change this line height_str = input("Height (cm): ") # do not change this line height_float = (float(height_str) / 100) weight_float = float(weight_str) bmi = (weight_float / (height_float)**2) print("BMI is: ", bmi) # do not change this line #BMI is a number calcu...
true
9036deafb3980f8f986cdd902fab447f91c55c32
danielle8farias-zz/hello-world-python3
/meus_modulos/numeros.py
2,770
4.28125
4
######## # autora: danielle8farias@gmail.com # repositório: https://github.com/danielle8farias # Descrição: Funções para: # validar número float; # validar número inteiro; # validar o divisor da operação de divisão; # validar índice de raízes; # validar números naturai...
false
7db3286c9184aa0405e47981b84fa87624ac8cee
rjrobert/daily_coding_problems
/daily12.py
1,580
4.125
4
""" Good morning! Here's your coding interview problem for today. This problem was asked by Amazon. There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. ...
true
1901e6e18d17b4595391d581443e672a924e2089
cse210-spring21-team4/cse210-tc06
/src/mastermind/game/player.py
1,259
4.15625
4
class Player: """A person taking part in a game. The responsibility of Player is to record player moves and hints. Stereotype: Information Holder Attributes: _name (string): The player's name. _move (Move): The player's last move. """ def __init__(self, players=list)...
true
e17792c43909aeb873441ff67efb33b42c2d1f84
vburnin/PythonProjects
/CompoundInterestLoops.py
2,028
4.53125
5
import locale locale.setlocale(locale.LC_ALL, '') # Declare Variables nDeposit = -1 nMonths = -1 nRate = -1 nGoal = -1 nCurrentMonth = 1 # Prompt user for input, check input to make sure its numerical while nDeposit <= 0: try: nDeposit = int(input("What is the Original Deposit (positive value): ")) e...
true
343e43016f793b6f56dcca61a38bc7ee7eb479a5
ajuliaseverino/tutoring
/tut/basics.py
1,420
4.21875
4
# print('Hello world') # x = 5.6 # print(x) # # print("\nFor loop from 0 to 9.") # for i in range(10): # print(i) def input_switch(): """A function definition. Calling the function by typing input_switch() will run this code. The code does *not* get run when you create the function. """ user_i...
true
94adb3c9cce3d65357bc0fcc29bb1f0986d73877
sinadadashi21/Wave-4
/pig-latin.py
758
4.21875
4
ay = "ay" way = "way" consonant = ("B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "Y", "V", "X", "Z") vowel = ("A", "E", "I", "O", "U") word = input("Enter the word to translate to Pig Latin: ") first_letter = word[0] first_letter = str(first_letter) first_letter=first_letter.upper() if...
false
66536ba1353fcefb8951dec0ad9f47e4557f30b3
Hamsik2rang/Python_Study
/References_Of_Object/Tuple.py
764
4.40625
4
# tuple # tuple is immutable object. so when you create tuple once, you can't change or delete element(s) in it. t = (1,) print(t) print(" remark: you can't create tuple that have an element without using comma(,). because it is confused with parenthesis operation.\n") t = (1,2,3) print(t) t = 1,2,3 print(t) # ind...
true
b5b661c4c6a50e6195d672b23b9d7ce00eb18490
Hamsik2rang/Python_Study
/Day13/Sources/Day13_2.py
234
4.3125
4
def is_pelindrome(word): if len(word)<2: return True elif word[0]!=word[-1]: return False return is_pelindrome(word[1:-1]) word = input("Type word to check it is pelindrome: ") print(is_pelindrome(word))
false
cd0e80bafd2a6c761dab0c92e11c4aa82b145466
Hamsik2rang/Python_Study
/Day14/Sources/Day14_6.py
514
4.375
4
# Generator # Generator is a function contain 'yield' keyword. # Generator works like iterator object. def my_generator(): # When Interpreter(Compiler) meet 'yield' keyword, Literally yield program flow(resources) to main routine. # It means return value there is next 'yield' keyword, and stop routine until nex...
true
87578912fbfeadc41774c42416ce99bc646a57cf
Hamsik2rang/Python_Study
/Day13/Sources/Day13_11.py
958
4.125
4
# Multiple Inheritance # Python support Multiple Inheritance. class Dragon: def breath(self): print("브레스!!!! 피해욧!!!!!") class Elf: def heal(self): print("치유 마법") class Player(Dragon, Elf): def attack(self): print("얍!") me = Player() me.breath() me.heal() me.attack() # Diamond...
true
c00c114531ecc3ccf2d29dd7457ed7c6c68ede60
daniellehoo/python
/week 1/math2.py
467
4.1875
4
# in Python you can do math using the following symbols: # + addtion # - subtaction # * multiplication # / division # ** exponent (not ^) # > greater than # >= greater than or equal to # < less than # <= less than or equal to # and more! answer = (40 + 30 - 7) * 2 / 3 print("what is the answer to life, the universe, ...
true
c92f0b239c93c37966774573e80496678d007f8e
lance-lh/Data-Structures-and-Algorithms
/剑指offer/printMatrix.py
1,505
4.21875
4
# -*- coding:utf-8 -*- ''' 输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字, 例如,如果输入如下4 X 4矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字 1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10. ''' class Solution: # matrix类型为二维列表,需要返回列表 def printMatrix(self, matrix): res = [] # 类似于旋转魔方,每次先输出matrix第一行并删除 # 然...
false
114d909c19bfde24e1e4cbccf337b15d6479e418
zerformza5566/CP3-Peerapun-Sinyu
/assignment/Exercise5_1_Peerapun_S.py
436
4.25
4
firstNumber = float(input("1st number : ")) secondNumber = float(input("2nd number : ")) plus = firstNumber + secondNumber minus = firstNumber - secondNumber multiply = firstNumber * secondNumber divide = firstNumber / secondNumber print(firstNumber, "+", secondNumber, "=", plus) print(firstNumber, "-", secondNumber,...
true
5e0aa09e18545eb0db0f8e21b613e29007b6e25a
nicolesy/codecademy
/projects/codecademy_project_cho_han.py
1,342
4.53125
5
# codecademy_project_cho_han.py # Create a function that simulates playing the game Cho-Han. The function should simulate rolling two dice and adding the results together. The player predicts whether the sum of those dice is odd or even and wins if their prediction is correct. # The function should have a parameter t...
true
18868e88cc99d47da4052c5231e1d78d4cba6332
dmproia/java1301_myPythonPrograms
/lab8.py
934
4.28125
4
#============================ # PROGRAM SPECIFICATIONS # NARRATIVE DESCRIPTION:Lab8 # # @author (David Proia) # @version(1/27/12) #============================== repeat = "Y" print ("This program is designed to tell allow you to tell if you have a right triangle or not" ) print () while (repeat == "Y"): X = fl...
true
215504ad95354baf30674044d4eb285dc87e8193
Nayalash/ICS3U-Problem-Sets
/Problem-Set-Five/mohammad_race.py
1,491
4.28125
4
# Author: Nayalash Mohammad # Date: October 19 2019 # File Name: race.py # Description: A program that uses the Tortoise and Hare Algorithm to simulate a race. # Import Required Libraries import random import time # Helper Function To Display Name and Progress def display(name, progress): print(name + ": " + str(...
true
94d53ee92c8275a4b71070097047f3085972db20
Nayalash/ICS3U-Problem-Sets
/Problem-Set-Seven/mohammad_string_blank.py
1,094
4.25
4
# Author: Nayalash Mohammad # Date: November 01 2019 # File Name: string_blank.py # Description: A program that replaces multiple spaces with one # Main Code def main(): # Ask for string string = input("Enter a string with multiple blank spaces...\n") # Regex the string, and join it newString = ' '.join(string.sp...
true
d46054d6f12fb1140e5db12b87a461d140910079
Nayalash/ICS3U-Problem-Sets
/Problem-Set-Three/mohammad_zodiac.py
1,726
4.46875
4
# Author: Nayalash Mohammad # Date: October 01 2019 # File Name: zodiac.py # Description: A program that displays your # zodiac sign based on your birthday # Ask user for their birthday try: day = int(input("Enter Birth Day: ")) month = int(input("Enter Month In Number Format (ex: September = 9) ")) except Val...
false
2c3dd09d52eaa860167288b7192be1bcca2b176a
Nayalash/ICS3U-Problem-Sets
/Problem-Set-One/digit_breaker.py
277
4.125
4
# Author: Nayalash Mohammad # Date: September 20 2019 # File Name: digit_breaker.py # Description: A program that splits the digits in a number # Ask a number from the user number = input("Enter a Three Digit Number: ") # Iterate over the provided string for i in number: print(i)
true
2494877cda4f8f5ebc6f88de5bd26cc0726d695e
Isaac3N/python-for-absolute-beginners-projects
/reading files.py
1,110
4.53125
5
# read it # demonstrates reading from a text file print("opening and a closing file.") text_file= open("readit.txt", "r") text_file.close() print("\nReading characters from a file.") text_file= open ("readit.txt", "r") print(text_file.read(1)) print(text_file.read(5)) text_file.close() print("\nReading the entire fi...
true
f75b734c0b6c1848e23253466a2a637dd5220983
Isaac3N/python-for-absolute-beginners-projects
/limited tries guess my number game.py
608
4.21875
4
# welcome to the guess my number game # your to guess a number from 1-5 # your limited to 3 tries import random print (" welcome to the guess my number game \n your limited to a number tries before the game ends \n GOOD LUCK !") the_number = random.randint(1,5) guess = input (" take a guess: ") tries = 1 while guess...
true
111c7e5018e2779b0cc2114a0c0883d6d40665b8
Lslonik/python_algorithm
/HW_1/HW_1.6.py
450
4.21875
4
# Пользователь вводит номер буквы в алфавите. Определить, какая это буква letter_number = int(input("Введите номер буквы английского алфавита: ")) if 97 <= ord(chr(96 + letter_number)) <= 122: your_letter = chr(96 + letter_number) print(f"Ваша буква: {your_letter}") else: print("Такой буквы нет в алфавите...
false
70c6046607605e1e817655ea5d67df32d6491468
Lslonik/python_algorithm
/HW_3/HW_3.2.py
930
4.125
4
# Во втором массиве сохранить индексы четных элементов первого массива. Например, # если дан массив со значениями 8, 3, 15, 6, 4, 2, второй массив надо заполнить значениями 0, 3, 4, 5, # (индексация начинается с нуля), т.к. именно в этих позициях первого массива стоят четные числа. import random SIZE = int(input('Введ...
false
988207876d95d5de27ef0fb9e14600343a9afe56
macheenlurning/python-classwork
/Chap3Exam.py
2,478
4.3125
4
# Ryan Hutchinson # Chapter 3 Exam # Programming Projects 1 & 3 #1 - Car Loan loan = int(input("Enter the amount of the loan: ")) if int(loan) >= 100000 or int(loan) < 0: print("Total loan value {} might be incorrect...".format(loan)) response1 = input("Would you like to correct this? Type Yes or No:...
true
157677c2d65797724248e4bec4396ffc2f698b5d
samirghouri/DS-and-ALGO-In-Python
/Recursion/recursion1.py
1,480
4.34375
4
# Lets take a look at the Fibonacci Series Example # We have the following conditions # F(0) = 0, F(1) = 1, F(2) = F(1) + F(0) , F(3) = F(2) +F(1) and so on # 0,1 when n =0,1 # F(n) = # F(n-1) + F(n-1) when n >=2 # Lets implement the function using two methods - 1.Iteratively 2. Recursively # 1.Ite...
false
a5405798c83b1ecc5b8095b4a8251ea3d6aa8fea
bapadman/PythonToddlers
/pythonTutorialPointCodes/IfElse.py
277
4.1875
4
#!/usr/bin/python # classic if else loop example flag = True if not flag: print("flag is true") print("Printing from if loop") else: print("flag is false") print("Printing from else part") #while loop sample i = 0 while i < 10: print("i = ",i) i = i +1
true
12e1b7a3613ff30f58297f3d9bd670acdb1beb98
gslmota/Programs-PYTHON
/Exercícios/Mundo 1/ex016.py
485
4.15625
4
# nome da pessoa e informações nome = str(input('Digite o nome: ')).strip() # serve para eliminar os espaços print( 'Seu nome em maiúsculas é: {}'.format(nome.upper())) print('Seu nome em minúsculas é: {}'.format(nome.lower())) print('Seu nome tem {} letras'.format(len(nome) - nome.count(' '))) print('Seu primeiro nom...
false
7604537c71142580cac2e42afb4ee9f484816477
gslmota/Programs-PYTHON
/Exercícios/Mundo 1/ex00.py
428
4.21875
4
# Desafio 4 Aula 6 # Mostra informações sobre o tipo prmitivo txt = input('Digite alguma coisa: '); print('O tipo primitivo de {} é {}'.format(txt, type(txt))); print('Só tem espaços? {}'.format(txt.isspace)); print('É um número? {}'.format(txt.isnumeric)); print('É alfabético? {}'.format(txt.isalpha)); print('É alfa...
false
55306a5cb494265ccaec0969650a6f311fe7270f
finolex/Python_F18_Abhiroop
/Lab 3 - Booleans/q3.py
485
4.125
4
import math firstLeg = int(input("Please enter the length of the first leg: ")) secondLeg = int(input("Please enter the length of the second leg: ")) hyp = float(input("Please enter the length of the hypothenuse: ")) hypCalc = math.sqrt(firstLeg**2 + secondLeg**2) if hyp == hypCalc: print("This forms a right ang...
true
5b275184d7845c54e6b3427b353d49d1e9fa22ba
finolex/Python_F18_Abhiroop
/Lab 4 - While loops/q3.py
247
4.15625
4
dividend = int(input("Please input a positive int for dividend: ")) divisor = int(input("Please input a positive int for divisor: ")) count = 0 quotient = dividend while quotient >= divisor: quotient -= divisor count += 1 print(count)
false
5c624b55e026aa8c9c506162767176dd19e4fd7c
finolex/Python_F18_Abhiroop
/Lab 3 - Booleans/q4.py
382
4.15625
4
num1 = int(input("Please enter your first integer: ")) num2 = int(input("Please enter your second integer: ")) if num2 == 0: print("This has no solutions.") elif (-num1/num2) > 0 or (-num1/num2) < 0: print("This has a single solution and x = .", (-num1/num2)) elif (-num1/num2) == 0: print("This has a singl...
true
172720a347baa8828443ba979fb4fe01b2e7f6f5
gabrielchase/MIT-6.00.1x-
/Week2/prob3.py
1,116
4.5
4
# Write a program that calculates the minimum fixed monthly payment needed # in order pay off a credit card balance within 12 months. By a fixed monthly # payment, we mean a single number which does not change each month, but # instead is a constant amount that will be paid each month. MONTHS_IN_A_YEAR = 12 # Given...
true
2db9fc416ebd7d63033eb5d30f83e7c51b1733aa
GabrielCardoso2019/Curso-de-Python
/Modulo03/A-Tuplas.py
1,130
4.34375
4
lanche = ('Hambúrger', 'Suco', 'Pizza', 'Pudim', 'Batata Frita') # Tuplas são imutáveis # lanche[1] = 'Refrigerante' <-- Não funciona # print(lanche) # trás do 1 ao 3 item print(lanche[1:3]) # Trás do 1 ao 0 (Python ignora um número) print(lanche[:2]) # Trás o 3º item de trás para frente print(lanche[-3:]) # Mostra to...
false
b785ed5bff4e17cb22b7ee84e0144ab222dedd45
green-fox-academy/FulmenMinis
/week-04/day-03/fibonacci.py
386
4.25
4
# Fibonacci # Write a function that computes a member of the fibonacci sequence by a given index # Create tests that covers all types of input (like in the previous workshop exercise) def fibonacci(n=0): if n < 0: return False elif n == 0: return 0 elif n == 1 or n == 2: ret...
true
a0aacffaecbcb78b56a2f2beecb7d2bf0b143f68
green-fox-academy/FulmenMinis
/week-03/day-04/number_adder.py
264
4.25
4
# Write a recursive function that takes one parameter: n and adds numbers from 1 to n. def recursive_function(n): if n == 0 or n == 1: return n else: return (recursive_function(n-1) + recursive_function(n-2)) print(recursive_function(10))
true
19684231d4bc2fa7ee4e71da4563451022e7c826
green-fox-academy/FulmenMinis
/week-04/day-03/sum.py
790
4.1875
4
# Sum # Create a sum method in your class which has a list of integers as parameter # It should return the sum of the elements in the list # Follow these steps: # Add a new test case # Instantiate your class # create a list of integers # use the assertEquals to test the resu...
true
29109f6f4dd6932523c63ff32de11b4598cfd4ff
green-fox-academy/FulmenMinis
/week-02/day-03/string02.py
661
4.15625
4
# Create a function called 'reverse_string' which takes a string as a parameter # The function reverses it and returns with the reversed string #Solution 1 reversed = ".eslaf eb t'ndluow ecnetnes siht ,dehctiws erew eslaf dna eurt fo sgninaem eht fI" reversed = reversed[::-1] print(reversed) #Solution 2 def slowreve...
false
3c7361f73a5fdee8d31f86f9961ba5f5239060cb
green-fox-academy/FulmenMinis
/week-02/day-05/armstrong_number.py
1,108
4.4375
4
#Exercise # #Write a simple program to check if a given number is an armstrong number. # The program should ask for a number. E.g. if we type 371, the program should print out: # The 371 is an Armstrong number. # What is Armstrong number? # An Armstrong number is an n-digit number that is equal to the sum of the nt...
true
f0bcacd257e329b9376e7c1fbe00161b8772c248
chicolucio-python-learning/hacker-rank
/array_2d/array_2d.py
802
4.15625
4
def hourglass_sum(arr): """Return the maximum hourglass sum in a given array Parameters ---------- arr : array an array of integers Returns ------- integer The maximum hourglass sum in a given array """ sum_pattern = [] for line in range(len(arr) - 2): a...
false
eef3efc9d6fbb3a27978cd4bdbba4c680eee92b1
depecik/-rnekler
/PythonTemelleri/Fonksiyonlar3.py
1,404
4.15625
4
# say = input("Kontrol etmek istediğiniz sayıyı giriniz") # toplam = 0 # for i in say: # toplam += int(i)**(len(say)) # if toplam == int(say): # print("Armstrong Sayısı") # def sayiKontrol(*args): # toplam = 0 # sayi = "" # for i in args: # toplam += int(i)**(len(args)) # sayi+=i ...
false
8164ea4320540ca503dc3493c629c74666eeec1f
ShivaVkm/PythonPractice
/playWithTrueFalse.py
769
4.25
4
# True means 1 and False in 0 print(True) # you will get True print(False) # you will get False print(True+False) # you will get 1 because True = 1 and False = 0 print(True == 1) # verification for trueness' value as equal to 1 print(False == 0) # verification for falseness' value as equal to 0 print(True+True) print(...
true
fa1ead85ec576a9d9f3f7595e855b0afcc5c2abc
rpt/project_euler
/src/problem001.py
597
4.1875
4
#!/usr/bin/env python3 # Problem 1: # 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. # Answer: # 233168 def problem1(n): def sumd(x, n): k = (n - 1...
true
303c154afaa831b39882865c536de7666c8af7c3
JiungChoi/NeuralNetworkOnColab
/regressionFunc2.py
914
4.21875
4
import matplotlib.pyplot as plt import numpy as np ## 입력 데이터 x의 개수 만큼 반복함 def cost(x, y, w): c = 0 for i in range(len(x)): hx = w*x[i] c = c + (hx -y[i])**2 return c/(len(x)) x_data = [1, 2, 3] y_data = [1, 2, 3] plt.plot(x_data, y_data, 'ro') plt.show() print(cost(x_data, y_data, -1)) print(cost(x_...
false
f746de4262b1c9f975a55ee02581b7a873ce1146
tglaza/Automate-the-Boring-Stuff-with-Python
/while_break_yourName_input.py
514
4.28125
4
#this is similar the first yourName program, except it uses a break to end the program #break statements are useful if you have several different places in a while loop that would allow you to leave from that point name = '' while True: #this would never be False so it's an infinite loop because it's always True ...
true
3caa06220975d573f9400da144c54c853555addc
robbailiff/database-operations
/sqlite_functions.py
1,920
4.84375
5
""" Here is some practice code for using the sqlite3 module with Python. Here I was experimenting with applying functions in SQLite statements. I have included comments throughout explaining the code for my own benefit, but hopefully they'll help someone else too. Hope you like the code. Any tips, comments or genera...
true
43d180dea65f2b5d65ec2da20c6524b0e42047c5
mareaokim/hello-world
/03_8번Gregorian.py
456
4.1875
4
def main(): print("Gregorian epact value of year.") print() year = int(input("Enter the year (e.g. 2020) : ")) c = year // 100 epact = (8+(c//4) - c + ((8*c+13)//25) + 11 * (year % 19)) % 30 print() print("The epact value is" , epact, "days.") main() >>>>>>>>>>>>>>> ...
true
d0a504f3603a3c9471c2826dd00cada6044f1a21
mareaokim/hello-world
/03_3번weight.py
700
4.28125
4
def main(): print("This program calculates the molecular weight of a hydrocarbon.") print() h = int(input("Enter the number of hydrogen atoms : ")) c = int(input("Enter the number of carbon atoms : ")) ox = int(input("Enter the number of oxygen atoms : ")) weight = 1.00794 * h + 12.01...
true
e18412d42429782751836ec1759665325a172b4f
mareaokim/hello-world
/03_12번number2.py
975
4.375
4
def main(): print("This program finds the sum of the cubes of the first n natural numbers.") print() n = int(input("Please enter a value for n : ")) sum = 0 for i in range(1,n+1): sum = sum + i**3 print() print("The sum of cubes of 1 through through", n, "is : ",s...
true
2decab40de10c88aa8102ab675e9fa1f3a46c8b0
riteshsahu16/python-programming
/2 loop/ex1.10_check_ifprime.py
270
4.125
4
#Q10. Write a program to check whether a number is prime or not. n = int(input()) i = 2 is_prime = True while(i <= n//2): if n%i==0: is_prime = False break i += 1 if is_prime: print("The no. is prime") else: print("The no. is NOT prime")
true
7dde7fa7aac2351a1d6eeead7dba6877f177db3b
riteshsahu16/python-programming
/1 if else/ex9_min_three.py
576
4.21875
4
#[9] Find minimum number out of given three numbers. print("Enter three no.") a = int(input("a: ")) b = int(input("b: ")) c = int(input("c: ")) if(a==b and b==c): print("all are equal") elif (a==b and a<c) or (a==c and a<b) or (a<b and a<c): if(a==b): print("a and b are equal & minimum") elif(a==c...
false
a0a1fbc6a48d45ccb858529ca0f5718390adeb00
MOIPA/MyPython
/practice/basic/text_encode.py
473
4.21875
4
# in RAM all text would be translated to Unicode # while in Disk there are UTF-8 str = u'编码' # Unicode now str = str.encode('utf-8') # UTF-8 print(str) str = str.decode('utf-8') print(str) # riverse a = u'\u5916' print(a) a = a.encode('utf-8') print(a) # -*- coding: utf-8 -*- # the above line means read the code fi...
true
6e0e2c9518732023f4416e5971029e73947d5ea3
MOIPA/MyPython
/practice/basic/list_tuple.py
372
4.15625
4
list_num = [1, 2, 3, 4, 5] print(list_num[-1]) # 3 # delete list_num.pop() # delete the end one list_num.pop(2) # delete the third one print(list_num) # add list_num.append(6) list_num.insert(0, -1) # update list_num[0] = 0 # tow dimensional array one = [2.1, 2.2, 2.3] array = [1, one, 2, 3] print(array[1][0]) ...
true
de89cb68e9d89a50e82a89a6711bb1fca137a703
kaysu97/Algorithm
/Recursion&Stack.py
2,489
4.15625
4
#!/usr/bin/env python # coding: utf-8 # f()的複雜度是多少 def f(problemSize): work = 0 for i in range(problemSize): for j in range(i, problemSize): work += 1 class Solution01: def complexity(self): print("n^2") # print your answer here. # 把所有位數相加用Recursion的方式 class Solution02: de...
false
17793d481db169e050b08a1c5dd1e281aa08e094
j16949/Programming-in-Python-princeton
/3.3/20_time/time_seconds.py
1,724
4.1875
4
#python官方文档time模块写道: #此模块中定义的大多数函数的实现都是调用其所在平台的C语言库的同名函数。因为这些函数的语义可能因平台而异,所以使用时最好查阅对应平台的相关文档。 #且python或C获取的时间都为运行程序的终端的时间,所以依据题意,想获得当前时间无论如何都得引入系统时间,无论是OS.SYSTEM()还是time。 #python有两个主要处理时间的模块:1.datetime;2.time,其中datetime也可以计算日期。datetime.datetime可以作运算返回datetime.timedelta对象,time.time()则返回float对象 #由于需要创建0点的时间,而time模块中t...
false
d47af399c0c701882f4c78b20395df6808d2c503
Douglass-Jeffrey/Unit-5-06-Python
/rounder.py
1,330
4.375
4
#!/usr/bin/env python3 # Created by: Douglass Jeffrey # Created on: Nov 2019 # This program turns inputs into a proper address format def rounding(number, rounder): # This function rounds the user's number # Process rounded_number = (number[0]*(10**rounder)) rounded_number = rounded_number + 0.5 ...
true
74ae9c1c92272b3cd54e2a76269ddf32994c5822
brentholmes317/Project_Euler_Problems_1-10
/Project_Euler/13_adjacent.py
1,086
4.34375
4
from sys import argv, exit from check_integer import check_input_integer """ This reads a file and finds the largest product that can be had by multiplying 13 adjancent numbers. The program needs the final line in the text to be blank. """ script, filename = argv txt = open(filename) reading = 1 #keeps track of if...
true
a743aabc9ab1fc15f8f5264af3b59dcbad5fc870
brentholmes317/Project_Euler_Problems_1-10
/Project_Euler/Pallindrome.py
1,250
4.53125
5
"""This program will find the largest pallindromic product of two three digit numbers""" #this program checks whether a 5-6 digit number is a pallindrome def is_pallindrome(number): #first we find if it is a 5 or 6 digit number if number // 100000 == 0: d5 = number // 10000 d4 = (number % 1000...
false