blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2fac38f338ff2374ad20510012af7a75097f1e5a
xbaysal11/Python
/AreaRectangle.py
320
4.1875
4
def rectangle_area(x, y): if x <= 0 or y <= 0: print("Incorrect input!") else: print(x*y) ''' num, num -> num Returns the area of the rectangle with dimensions:width & height >>> rectangle_area(4,5) 20 ''' x = int(input()) y = int(input()) rectangle_area(x, y)
true
c37fe4646db9ea95964237a6f804f73a009076ec
metodosexatos/IPEP
/14.DataStructures_Lists.py
1,573
4.375
4
#!/usr/bin/env python # coding: utf-8 # # Lists # 1. A list is a sequence of values of any data type. # 2. A list can be created by storing a sequence of different types of values separated by commas. # 3. A Python list is enclosed between a square brackets([]), and elementes are stored in the index based on a starti...
true
0377261a7c89c1a3b4e9c7db7b4eef1fdb311180
metodosexatos/IPEP
/27.DataStructures_Series.py
2,138
4.25
4
#!/usr/bin/env python # coding: utf-8 # # Series # ### A series is defined as a one-dimensional labeled array capable of holding any data type (integers, strings, floating-point numbers, etc..) # ### Creating a Series with index # In[1]: # Creating a series with labels import pandas as pd series1 = pd.Series([4, ...
true
365cb754e272f8c8d575784d62590c53570f808b
metodosexatos/IPEP
/25.DataStructures_Tuples.py
2,175
4.625
5
#!/usr/bin/env python # coding: utf-8 # # Tuples # ### A tuple is a sequence just like a list of immutable objects. The differences between tuples and lists are that the tuples cannot be altered; also, tuples use parentheses, whereas lists use square brackets. # ## Creating Tuples # In[1]: # Creating and displayi...
true
182a812f9ea71099974dc22ad6d274c97e44e67a
EchoZen/SBS-tutorials
/Tut5Qn8 Cylinder Circle Rect.py
803
4.21875
4
choice= int(input("Choose\n 1. Cylinder\n 2. Circle\n 3. Rectangle:")) import math if choice!=1 and choice!=2 and choice!=3: print("Invalid input") else: if choice==1: radius= float(input("Enter radius:")) height= float(input("Enter height:")) cylinder= math.pi*radius*radius*2 + ...
true
bafafc67fc417df06bfdd8da5d2215f14cea8f2f
gilbertduenas/HackerRank---10-Days-of-Statistics
/Day 1: Quartiles.py
1,195
4.1875
4
# https://www.hackerrank.com/challenges/s10-quartiles/problem # In statistics, a quartile is a type of quantile which divides the number of data points into four parts, or quarters, of more-or-less equal size. # The data must be ordered from smallest to largest to compute quartiles; as such, quartiles are a form of o...
true
47b2d4cfe028b3f7a31002f508723ada07fd5d4c
octoberdearest/Python
/Exercise1_Number.py
310
4.125
4
total_bill = float(input('Input total bill:')) payment = float(input('Input total payment:')) change = payment - total_bill print('Your change is {}'.format(change)) print('Your total bill is ' + .format(total_bill) + 'and your total payment is ' + .format(payment) + 'Your change is ' + str(change))
true
64dd64fbcf1494fcc2749079e75b4454072cda9a
CiscoDevNet/intro-python-code
/intro-python/part2/variable_scope.py
972
4.34375
4
#!/usr/bin/env python """Demonstrate module vs. locally scoped variables.""" # Create a module variable module_variable = "I am a module variable." # Define a function that expects to receive a value for an argument variable def my_function(argument_variable): """Showing how module, argument, and local variable...
true
18bb28db7da1d433b76f1efd371798b3b2531337
ranqiwei/DataReptiles
/algorithm/selection_sort.py
920
4.375
4
#!/usr/bin/env python # ! -*-coding:utf-8-*- # find the smallest number, and return index def find_smallest(arr): smallest = arr[0] smallest_index = 0 for i in range(len(arr)): print 'The %d times compare with smallest' % i if smallest > arr[i]: print '--The times %d...
true
053b1ded121f188464d352ff99ab63e2c3ef08a4
thatnepkid/itp_week_1
/day_4/lecture.py
356
4.28125
4
my_car = { "brand": "Ford", "model": "Mustang", "year": 2021, "interest": 22 } print(my_car) # Dictionary items are ordered, changeable, and does not allow duplicates. # Dictionary items are presented in key:value pairs, and can be referred to by using the key name. print(my_car["year"]) print(len(my_car))...
true
69f366cf8ddc8b6fbb0db41fe83ce005e335d8ff
Trietptm-on-Security/InfoSecPython
/cybrary/2 - Apprentice Python/Coding/ProgramModularization.py
2,302
4.53125
5
#!/usr/bin/python #Write a program with a menu that has the following options: # Accept and store a string # Basic Calculator # Print previously stored string # Compare 2 numbers, return the larger one # Remove a specific letter from a string storedString = "" def menu(): print "Press 's' to store a string" print ...
true
fc923c1d814130b4b5b6752bf1c050da5b2d67fb
kemi-mabel/Technical-task
/Task_8.py
1,072
4.125
4
"""Write a method to count the number of 3s that appear in all the numbers between 0 and n (inclusive). It should return an object containing the count of the number of 3s that appear and an array of the numbers that have 3s in them Example: Input: 35 Output: { count: 10, numbers: [3, 13, 23, 30, 31, 32, 33, 34, 35] ...
true
af322456e3af3ece3223ed2631d06c470a29d187
Baneeishaque/classification_iris_flowers
/multiple_regression_prediction_demo.py
592
4.34375
4
# example of training a final regression model from sklearn.datasets import make_regression from sklearn.linear_model import LinearRegression # generate regression dataset X, y = make_regression(n_samples=100, n_features=2, noise=0.1) # fit final model model = LinearRegression() model.fit(X, y) # new instances where w...
true
2b60192fcacbb603b138e5fa7c78d22703aabe5d
mdr0id/ACC_Dev
/CSC-119/src/Conversions/bin_to_int.py
925
4.46875
4
#In Class Program 8 Examples bin_num = input("Enter a binary num: ") #create a variable to sum each bit per coefficient int_val = 0 #create a variable that starts at the highest power - 1 exponent = len(bin_num)-1 #use a for loop to iterate per bit for bit in bin_num: int_val += int(bit) * (2**exponent) expon...
true
954221f517cc4e3c375ad8b844f9ef02a9d9ddf8
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/c29_HandlingBadInput/handling_bad_input/handling_bad_input.py
1,387
4.3125
4
""" Defines a function that estimates the number of years to double an investment """ def get_positive_nonzero_number(prompt, err_msg): """Prompts the user for a positve non-zero number Args: prompt (str): Prompt for the end user err_msg (str): Error message displayed if input is invalid ...
true
3101899ce3b0ef90bcf5043f323acd5a845a608a
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/c30_MultiplicationTable/multiplication_table/multiplication_table.py
403
4.21875
4
""" Defines a function that creates a multiplication table """ def multiplication_table(base): """Creates a multiplication table for every number from 0 to base""" for first_num in range(base+1): for second_num in range(base+1): print(f"{first_num} x {second_num} = {first_num * second_num}")...
true
8aab95eeacc1e9e7628018a689cae56b7e1f969a
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/28_AddingNumbers.py
669
4.375
4
""" Write a program that prompts the user for five numbers and computes the total of the numbers. ___________________ Example Output ___________________ Enter a number: 1 Enter a number: 2 Enter a number: 3 Enter a number: 4 Enter a number: 5 The total is 15. ___________________ Constraints ___________________ The p...
true
76e43b005d26105fb5fe7ffda35f6443968e43fd
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/c46_WordFrequency/46_WordFrequencyFinder.py
1,704
4.34375
4
""" Knowing how often a word appears in a sentence or block of text is helpful for creating word clouds and other types of word analysis. And it's more useful when running it against lots of text. Create a program that reads in a file and counts the frequency of words in the file. Then construct a historgram displayi...
true
ed795c215368db494b4a0a7e7bef7514d2ee0629
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/37_PasswordGenerator.py
2,802
4.5625
5
""" Coming up with a password that meets specific requirements is something your computer can do. And it will givev you practice using random number generators in conjunction with a list of known values. Create a program that generates a secure password. Prompt the user for the minimum length, the number of special c...
true
84e0083e9a6552e7042bcf04e09d424e856e5f28
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/c45_WordFinder/45_WordFinder.py
1,352
4.375
4
""" THere will be times when you'll need to read in one file, modify it, and then write a modified version of that file to a new file. Given an input file, read the file and look for all occurrences of the word utilize. Replace each occurrence with use. Write the modified file to a new file. ___________________ Exam...
true
55860dc9667e48e82b3fbf93f09fac6f93297377
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/38_FilteringValues.py
1,642
4.59375
5
""" Sometimes input you collect will need to be filtered down. Data structures and loops can make this process easier. Create a program that prompts for a list of numbers, separated by spaces. Have the program print out a new list containing only the even numbers. ___________________ Example Output _________________...
true
846b3e96a7d6107a2051834dc86acab203d72d59
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/c10_SelfCheckout/self_checkout/self_checkout.py
2,002
4.21875
4
""" Defines and implements a shopping cart / checkout class """ class ShoppingCart(): """ Representation of a shopper or shopping cart Attributes: TAX_RATE: A float constant that represents the tax rate (5.5%) cart: A dictionary the tracks the {'price', and 'quantity'} of items added ...
true
e73f1ab834cccf422630878ce996f57027855c95
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/34_EmployeeListRemoval.py
1,986
4.46875
4
""" Sometimes you have to locate and remove an entry from a list based on some criteria. You may have a deck of cards and need to discard one so it's no longer in play, or you may need to remove values from a list of valid inputs once they've been used. Storing the values in an array makes this process easier. Dependi...
true
ee3ec40403bb67790ab0f341275f3aff11c6f56b
andrew-rietz/FiftySeven_Coding_Challenges
/challenges/31_KarvonenHeartRate.py
2,739
4.46875
4
""" When you loop, you can control how much you increment the counter; you don't always have to increment by one. When getting into a fitness program, you may want to figure out your target heart rate so you don't overexert yourself. The Karvonen heart rate formula is on method you can use to determine your heart rat...
true
9cc4ddc3f7a724806fea6842a8c3050ba25a6d58
allifizzuddin89/ML_Python_Exercises
/dict.py
1,076
4.15625
4
#5.5 dictionaries #dictionaries are indexed by keys #unlike list/sequence, indexed by range of numbers #dict are a set of key : value pairs #dict is immutable print('\n','-'*80) tel = {'jack': 4098, 'sape': 4139} tel['guido'] = 4127 #add guido print(tel) print(tel['jack']) #print(tel['4139']) cannot cal...
true
45a47c79160a813d031597ea9435036b1c2a584a
cvhs-cs-2017/practice-exam-Narfanta
/Loops.py
330
4.3125
4
"""Use a loop to make a turtle draw a shape that is has at least 100 sides and that shows symmetry. The entire shape must fit inside the screen""" import turtle shape = turtle.Turtle() shape.pu() shape.left(90) shape.forward(200) shape.right(90) shape.pd() for i in range(150): shape.forward(10) shape.right(2.4...
true
26d7c1938920cf137d031e6d8672c9f6824c2cf3
pushparajkum/python
/4lecture_19jan/verbly.py
386
4.1875
4
'''WAP to accept a string from user and perform verbing operations on it. (rules : 1. len shld be gt or eq 3 2. add ing to its end 3. if ending in ing replace with ly 4. if len lt 3 then string unchanged)''' string1 = input("Enter a string : ") if(len(string1) >= 3): if(string1.find('ing')): string...
true
dddb274eb9e781801738250ce276993aea8ff681
Ateebkhalid/python
/calc.py
482
4.1875
4
print("Welcome to my calculator") num1=int(input("Enter the first number =")) num2=int(input("Enter the second number=")) print("Please select an operator") print("For Addition please press 1") print("For subtraction please press 2") print("For multiplication please press 3") print("For division please press 4") choice...
true
0a5fb5faf964f38b21cd6fb579eccfc771838e22
gregflores/PythonCrashCourse
/Chapter 5/6_amusement_park.py
1,952
4.53125
5
# if-else Statements # Often you'll want to take one action when conditional test passes and a different action in all other cases # if-else syntax makes this possible # An if-else block is similar to a simple if statement, but the else statement allows you to define an action or set of actions that are executed when t...
true
d6e55db81130af6db2dbb328081ed4a7fa5971f8
gregflores/PythonCrashCourse
/Chapter 3/1_bicycles.py
1,637
4.5625
5
#* A list is a collection of items in an order # You can put anything you want into a list and they don't have to be related in any way # naming convention is to make list names plural since they contain multiple items # In Python square brackets [] indicate a list # Items are seperated by commas bicycles = ['trek', '...
true
9b3e0ba2808f96b2add905ef13e9c7b11c5ae475
gregflores/PythonCrashCourse
/Chapter 6/3_user.py
1,085
4.75
5
#* Looping Through a Dictionary # A single Python dict can contain just a few pairs or millions of pairs # Python lets you loop through a dict # There are several ways to loop through them # Through its key-value pairs, keys, or values #* Looping through all key-value pairs # You can access a single piece of info abo...
true
31ed1b40f61e28a0e61ab91b0578f7b7fca36167
kethan1/Level-3-Evaluation
/part1_class_section/multithreading_part.py
849
4.375
4
""" Multithreading 1. Give an example of the following for threads. a. Creating b. Starting 2. Explain the concept of multithreading and the objective of using it. Multithreading can be to have two pieces of code run concurrently. For example when implementing full duplex communication, the sending and recieving has t...
true
69229fc8cbec45184dc1f5a9fd8a842d9b97de6b
Lisageers/progtheorie1110
/main.py
2,411
4.1875
4
""" main.py Minor programmeren, programmeertheorie January 2020 Marte van der Wijk, Lisa Geers, Emma Caarls Connect gates on a grid. """ from code.classes import chip, netlist, wiring from code.visualisation import matplot if __name__ == '__main__': # let user choose a chip while True: req_chip = input("Which...
true
c51d93b54f74baf1bd8d862c537b3e11e4c27d32
qiaokang92/Algorithms
/python/graph.py
1,858
4.3125
4
#!/usr/bin/python3.6 #https://eddmann.com/posts/depth-first-search-and-breadth-first-search-in-python class Graph: def __init__(self, graph): self.graph = graph def dfs(self, start): print("dfs:") visited = set() stack = [start] while len(stack) > 0: nextNode = stack.pop(...
true
c7e36b10499f4ec53c2c29574d6be5424b3910ed
sonurounier/PythonPrograming
/S03Q01_another_way.py
704
4.1875
4
""" This program will check digit of a number """ # Implement the helper functions here def perform_check(number): """ This function uses helper functions check_if_2digit check_if_3digit to perform the required operations """ if number<10 or number>999: print ("Entered numb...
true
e1955f08ceb31219402b4c1d645050ef6ede654e
sonurounier/PythonPrograming
/S03Q01-digit_check.py
854
4.1875
4
""" This program will check digit of a number """ # Implement the helper functions here def perform_check(number): """ This function uses helper functions check_if_2digit check_if_3digit to perform the required operations """ original_number=number digit_count=0 while(numer...
true
0610fc53738e21e70e02d1097722161f56dbbf3d
sonurounier/PythonPrograming
/S07Q03-string_position.py
964
4.25
4
''' Prompt the user to enter a long sentence - What is the last character in the sentence ? - What are the last 5 characters in the sentence ? - Print the characters that are present in 2nd and 5th position of the sentence - Print the character at the center of the string, along with the...
true
99c240125f5aff2f9e5b4d5af863effbe228a5d8
sonurounier/PythonPrograming
/S08Q01.py
213
4.28125
4
''' Ask the user to enter a number. Find the number of digits in that number ''' #Main Starts from here inp_number = input("Please enter any number:") digit=len(inp_number) print("Its",digit, "digit number" )
true
53ed85109ae1aeaa2f0b8a552361b701591d3f7e
honeymethil/hello
/list.py
663
4.4375
4
#names = ["Honey", "Seena", "Anu"] #print(names) #names = [] #create an empty list names = list() # create an empty list names.append("Honey") # since list are immutable you can add values using append method names.append("Seena") names.append("Anu") print(names) names.append("Shiva") print(names) names.appe...
true
68a71e4222870ddb746facb471c8897eafde3a88
ShelbyGauthier/MyPythonCodShelby
/practice.py
400
4.375
4
#If the temperature is between 60 and 70 degrees #Then turn on the heater! #If the temperature is above 80 degrees... #Then turn on the air conditioner! print "What is the temp?" temperature = int(raw_input()) print "What is the day" day = raw_input() if (temperature > 60 and temperature < 70) or day == "Sunday...
true
d5a9335f854189225fd5656ad8af7b3a970a1406
DharaTandel/ConsultADD_Python_Assignment
/Task2Ex1.py
567
4.5625
5
# 1. Write a program in Python to perform the following operation: # If a number is divisible by 3 it should print Consultadd as a string # If a number is divisible by 5 it should print Python Training as a string # If a number is divisible by both 3 and 5 it should print Consultadd - Python Training as a string. a = ...
true
3ee240900affce6ad3a07ed626c8031d4604b978
AmyE29/snakes-cafe
/snakes_cafe.py
1,194
4.28125
4
import sys # creating menu a = """ ###################################### ## Welcome to the Snakes Cafe! ## ## Please see our menu below. ## ## To quit at any time, type quit ## ###################################### MENU Appitizers ---------- chips and guac quesidillas nachos tortilla soup Entrees --...
true
2d1c25fdbfa39cfae5ae2724ad1d00da15fb1ea3
neotamoe/hackerRank
/python/math/powerModPower.py
429
4.59375
5
# Powers or exponents in Python can be calculated using the built-in power function. # You can use either pow(a,b) or a**b. # # You are given three integers: a, b, and m, respectively. Print two lines. # The first line should print the result of pow(a,b). # The second line should print the result of pow(a,b,m). a = in...
true
14829773c601f0a825ecb53a0397eca51252e967
jbmenashi/coding-lessons
/Pathrise/Backtracking/shrinkable-word.py
490
4.125
4
# given a diction, reduce a word letter by letter and have it be in the dictionary # can remove a letter from wherever # so the base case is get when its not a valid word def is_shrinkable(word, lexicon): if len(word) == 1: return True else: for letter_index in range(len(word)): shrunken_wo...
true
6925f702dd5d920d2cb079ecf48a900af34b2802
weinen-j/MIT_6.00.1x_solutions
/miscleaneous/recursion.py
359
4.21875
4
# -*- coding: utf-8 -*- """ Created on Sun Feb 28 21:17:43 2021 @author: Jonas """ def recur_power(base, exp): ''' base: int or float. exp: int >= 0 returns: int or float, base^exp ''' # Your code here if exp == 1: return base * exp else: return base * recur_power(bas...
true
d081c330715c29dd9613b81d5a763bafe9459370
ChiranthakaJ/Google-Using-Python-to-Interact-with-the-Operating-System
/Python_File_Operations_Iterating_Through_Files.py
1,047
4.53125
5
#Example 01 - Iterating through the file content line by line and printing line by line. with open("Python_File_Sample_V2.txt") as file: for line in file: print(line) #Example 02 - Iterating through the file content line by line and printing line by line. Also this removes the line spacing that ...
true
3f25a9671d5d1f191c387b496327e03bb7d92f6b
ChiranthakaJ/Google-Using-Python-to-Interact-with-the-Operating-System
/Python_File_Operations_Part_01.py
1,081
4.65625
5
#Example 01 - File openning and reading the content. Once done that closing. #open() method is used to open a file in Python. Once you open the file the content will be available and the content needs to be assign to a variable in order to read. In here 'file' is the variable that holds the content once the file openn...
true
bb2dcf458be6b9f5321c9dc867e6fa4b3c895f56
meriengel/PRG105
/chapter8/ch_8_practice.py
2,250
4.5625
5
""" Complete all of the TODO directions The number next to the TODO represents the chapter and section that explain the required code Your file should compile error free Submit your completed file """ # TODO 8.1 Basic string Operation # 1. Print all the characters from the name variable by accessin...
true
0ad4d035dd8335f3c743a92a8b725f9b9e2a141c
fivaladez/Python_Tutorial
/01_Getting_Started/01_User_Input.py
328
4.4375
4
# =========== Interactive input =========== # Python 2: name = raw_input("What is your name? ") # Python 3: name = input("What is your name? ") name = input("What is your name? ") print(name) # The function takes a string argument, which displays it as a prompt and returns a string x = input("Write a number:") print(...
true
9bef043caf76fbacd8e4847d41f246d5628ce03f
asadzia/Raspberry-Pi
/LED/LED.py
680
4.28125
4
""" A program for blinking an LED light on pin 7 of a Raspberry Pi. Created By: Asad Zia """ import RPi.GPIO as GPIO import time def blink(pin): # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(7, GPIO.OUT) blinks = input("Pl...
true
115450b74fa1c8b034368c96d94e97af7887f61e
Mekeda/CSCI-1300-Introduction-to-Programming
/Recitation Materials/Example 1.py
264
4.125
4
#Ask for a number between 50 and 200 and print all numbers between 1 and then input that are divisible by 3. Print the sum of all others. x=int(input("Pick a number between 50 and 200: ")) y=0 for i in range(1,x+1): if i%3==0: print(i) else: y=y+i print(y)
true
8eb5e245d38049d499699af36037c52433f36e23
Mekeda/CSCI-1300-Introduction-to-Programming
/Assignment 3/spencer_milbrandt_assignment3.py
1,543
4.21875
4
""" Add your required comments up here. You can get them from the assignment 2 file if you would like. """ # futval.py # A program to compute the value of an investment # carried 10 years into the future def main(): # Step 1: it isn't always a 10 year investment now, change this so it makes sense print("This progr...
true
836ca362e2ed0d6964f77701eb96a90ba21d3f8b
MatthewDCantor/Python
/graph_problems/flood_fill.py
1,773
4.125
4
""" // A recursive function to replace previous color 'prevC' at '(x, y)' // and all surrounding pixels of (x, y) with new color 'newC' and floodFil(screen[M][N], x, y, prevC, newC) 1) If x or y is outside the screen, then return. 2) If color of screen[x][y] is not same as prevC, then return 3) Recur for north, ...
true
d803a374a9e3de152e3977425474672b56eacb34
tawfiqul27/python_code
/07_class_&_constructor.py
1,639
4.25
4
### Creating a class # class Duck: # sound = 'Quack quack' # these are data in the form of variable # movement = 'walks like a duck' # def quack(self): # method in the form of function. The parameter of the method is self which is not a keyword # print(self.sound) # you ca...
true
f13fbe8455ad00d2af61443a01dd6e49c4cb8621
tawfiqul27/python_code
/variables_start.py
657
4.375
4
# example file for variables # declae a variables and initialize it f=0 print(f) # re-declare the variable works f="abc" print(f) # ERROR: variable of different types cannot be combined print ("this is a string " + str(123)) # Global vs. local variables in functions g=3 def someFunction(): global g ...
true
0eb6783be9a3a730bfeabc2a85bf2b281b9c608b
GangiVivek/MyCaptainPythonTasks
/task6.py
687
4.15625
4
s1=0; s2=0; s3=0; s1=input("Enter the lenght of side one of the triangle :"); s2=input("Enter the lenght of side two of the triangle :"); s3=input("Enter the lenght of side three of the triangle :"); if s1==s2: if s2==s3: print("This is an Equilateral triangle"); else: print("This is...
true
232d8c7b818d99a160d5c3e0b3960e567ca9acc2
Btagra/python
/Assignment-2/seven.py
567
4.375
4
# Write a program to return True if the list consist only integer values only and if not return false. #The isinstance() function returns True if the specified object is of the specified type, otherwise False. res=all(isinstance(x, int) for x in [1,2,3,4]) print res res=all(isinstance(x, int) for x in [1,"hello",3,4,5...
true
5376fe759d420e7b064b4c86eba5a4dc2e813396
HunterDietrich/Number-Guessing-Game
/main.py
1,269
4.125
4
import random print("*****WELCOME TO THE GUESSING GAME*****") print("I AM A COMPUTER, GUESS MY NUMBER") computerNum = random.randint(0,20) print(computerNum) #state variables win = False still_playing = True tries = 5 while still_playing == True: while tries > 0: print() playerNum = int(input("...
true
59c3b33e9909c62c79b6d733ffd53dced876ab8f
iamlleek/bouncygui
/bounceygui.py
2,412
4.1875
4
""" program: bounceyGUI.py Author: Nylek 10/20/2020 GUI-based version of bouncy.py app. Program will calculate the total distance travelled by a bouncing ball. User will input: The starting height of the ball How bouncy the ball is How many bounces the ball will make The output should be the total distan...
true
54c220443d25eb5b9b107f609b25eb992c3286ac
migzpogi/pagsusulit
/araw/araw.py
1,770
4.28125
4
class Araw(object): def get_number_of_days(self, year): """ Gets the number of days in a year :param int year: Year to get the number of days of :return int: Number of days """ if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: ...
true
f15b5dc7367e7f593ffbd7a2ca8b445df8395a7e
hooting/leetcode
/python_src/ImplementTrie.py
1,573
4.15625
4
class TrieNode(object): def __init__(self, isWord = False): """ Initialize your data structure here. """ self.isWord = isWord self.dc = [None] * 26 class Trie(object): def __init__(self): self.root = TrieNode() def insert(self, word): """ In...
true
46063be42b63d544a358c81eb7ad9062a6840315
KoundinyaP/pythonProject
/app.py
271
4.125
4
# Given two integer numbers return their product. If the product is greater than 1000, then return their sum a = int(input("Enter the 1st number : ")) b = int(input("Enter the 2nd number : ")) if (a*b > 1000): print("Sum = ", a+b) else: print("Nothing to print")
true
95173ee4081b0bb292432163a10144167ff08973
timothyseguiawork/ProgFolder
/ex17.py
2,414
4.375
4
# Exercise 17: More Files # 06/06/17 # Now lets do a few more things with files. We'll write a Python Script to copy one file to another. # It'll be very short ut will give you ideas about other things you can do with files. from sys import argv # Similar to accepting a list of the arguments to your program from os.p...
true
16b5113d85660e4650bd8ff023abce4d621ade48
timothyseguiawork/ProgFolder
/ex11.py
895
4.25
4
# Exercise 11 & 12: Asking Questions & Prompting People # 05/26/17 # Most of what software does is the following # 1. Take Some kind of input from a person # 2. Change it # 3. Print out something to show how it changed # So far you have been printing strings, but you haven't been able to get any input from anyone # Y...
true
da543d67bd6a75c804e05d3b30a59722911e8931
joshie373/web-335
/week-8/hughes_calculator.py
696
4.625
5
# ============================================ # ; Title: Assignment 8.3 # ; Author: Joshua Hughes # ; Date: 3 December 2019 # ; Modified By: Joshua Hughes # ; Description: Demonstrates basic # ; python operation # ;=========================================== # function that takes two parameters(numbers) and adds them...
true
6198c5c0bd64ebd7cb91e9b55926edaad83ff37e
jgartsu12/my_python_learning
/python_data_structures/lists/median_odd.py
1,202
4.1875
4
# How to Find the Median of a Python List with an Odd Number of Numbers ''' Tools: - math library - sorted function - list slicing - computations ''' import math sale_prices = [ 100, 83, 220, 40, 100, 400, 10, 1, 3 ] #sorted method to sort lists sorted_sales_prices = sorted(sale_prices) # sort list ...
true
2d15771e484e649fe6118c17996851a0367b6988
jgartsu12/my_python_learning
/python_data_structures/lists/add_to_list.py
807
4.40625
4
# How to Add to a List in Python with Both In Place and Copy Processes tags = ['python', 'development', 'tutorials', 'code'] # algorithms when iterating over a list makes u add elements to the list while looping through it # key differences between In Place vs Copy # how can we store it in new variable # THIS IS NOT I...
true
7307c88244801bfe9cdc0fd12ac9a9e75b176842
jgartsu12/my_python_learning
/python_data_structures/tuples/remove_elements.py
1,468
4.59375
5
# Three Ways to Remove Elements from a Python Tuple # tuples are immutable so original is not having anything removed but the new ones will be new tuples with elements removed # real world situation u didnt create the tuple but working with outsdie library with collection and cant ctrl tuple is what u have to work w/ ...
true
9dad2ef039fd7d216049ffb56bb31d5e8fd48e0c
greyinghair/kpmg_answers
/lesson_5/Questions/q3_guess_random.py
746
4.25
4
# Rewrite Q2 so that the number being guessed is a random value from 1 to 10 import random number = random.randint(1,10) # variable to chose random integer between 1 and 10 guess = 0 # define variable and set to zero while number != guess: # as long as number is NOT the same as guess. Ie input and computer values do...
true
d52aec64589b72ec60646aa50c6b7d61dea3c360
chriscross00/practice_python
/16.password_generator.py
1,117
4.34375
4
'''Write a password generator in Python. Be creative with how you generate passwords - strong passwords have a mix of lowercase letters, uppercase letters, numbers, and symbols. The passwords should be random, generating a new password every time the user asks for a new password. Include your run-time code in a main me...
true
d760f34b044c5d0ea869b6bf356c3d2fd2d6abb9
chriscross00/practice_python
/9.guessing_game_one.py
2,689
4.40625
4
'''Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (Hint: remember to use the user input lessons from the very first exercise) Extras: Keep the game going until the user types “exit” Keep track of ...
true
e90756a2ec4454f54e39c933b651a788ff04fa6e
Datny/Algorithms
/linked_list_reverse.py
862
4.3125
4
# Write a function to reverse a Linked List in place. # The function will take in the head of the list as input # and return the new head of the list. # TODO: Rewrite + learn. class Node(object): def __init__(self, value): self.value = value self.nextnode = None def reverse(head): # Set up cu...
true
72190ed3ab1452446a830b235db0980af4d75ded
vjchele/PythonScripts
/ugly_numbers.py
953
4.15625
4
''' Ugly Numbers Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … shows the first 11 ugly numbers. By convention, 1 is included. Given a number n, the task is to find n’th Ugly number. Examples: Input : n = 7 Output : 8 Input : n = 10 ...
true
9719144c43c949bb8ea249800ace3d00fe4c4307
lcadenas/StoryTelling
/MadLibs.py
1,410
4.21875
4
""" Complete the story with adjetives and nouns that first come to your mind. Let's see how much creative you are! Have FUN!!! """ # The template for the story STORY = "This morning %s woke up feeling %s. 'It is going to be a %s day!' Outside, a bunch of %ss were protesting to keep %s in stores. They began to %s to ...
true
7e34826b7c525c9210453500a45baba11242e3ae
alanmynah/Practice
/Learning Curve/Python/MIT 6.001x/Problem Set 2 _2.py
1,233
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 2 18:02:29 2017 @author: michael Now 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...
true
e55755b7124325f7e8e61ec86059992a3e21ec25
volhatt/leetcode
/easy/valid_brackets.py
2,509
4.125
4
""" https://leetcode.com/problems/valid-parentheses/ Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Examp...
true
8106bf1a0f393679cb48199fc9047df4d5a49fee
JoelDavisP/Python-Practice-Book-Solutions
/chapter2/p28.py
203
4.1875
4
def enum(l): """This function takes a list and returns a list of tuples containing (index,item) for each item in the list. """ print [(i,l[i]) for i in range(len(l))] enum(["a", "b", "c"])
true
80806d13558b082c81c30d79f1a147e60c9478df
JoelDavisP/Python-Practice-Book-Solutions
/chapter2/p24.py
265
4.21875
4
def zip_list_comp(l1,l2): """Input two lists and output a list which zips two lists using list comprehension. """ print [(l1[x], l2[y]) for x in range(len(l1)) for y in range(len(l2)) if x == y ] zip_list_comp([1, 2, 3], ["a", "b", "c"])
true
8962d52a788f6103e05d67e64043b68bb084c2f0
verhulstm/python-training
/kevin-harris-python-tutorial/py_python_introduction/string_indexing.py
1,245
4.625
5
#------------------------------------------------------------------------------ # Name: string_indexing.py # Author: Kevin Harris # Last Modified: 02/13/04 # Description: This Python script demonstrates the different ways of # indexing string data. #--------------------------...
true
e72f66f1fe468920f7d7e33e71601b1674c6ef1d
verhulstm/python-training
/kevin-harris-python-tutorial/py_python_introduction/if_conditional.py
976
4.6875
5
#------------------------------------------------------------------------------ # Name: if_conditional.py # Author: Kevin Harris # Last Modified: 02/13/04 # Description: This Python script demonstrates how to use if-else # conditionals. #--------------------------------------...
true
3ee1f8073339f5771fd0d9a4edb698eb45c0edfb
huda29/python--project
/day13.py
732
4.4375
4
#day13 #create list H =[] print(H) #numbers numbers =[1,2,3,4,5] print(numbers) #texts programing =["java","php","mysql","python"] print(programing) #access item programing =["java","php","mysql","python"] print(programing[2]) #texts with numbers programing =["java","php","mysql","python",1.9,2.6,3.2,4.0]...
true
ead19206ada2c4c01101b93337f2e831f747bd2e
huda29/python--project
/day67,68.py
323
4.125
4
# week 10 # challenge of week 10 name = input ('please enter the first and the end letter of your name :') print(f'your name is begin with {name[0]}, and end with {name[1]}') ################## name = 'Ahmed Ali' balance = '53.44' text ='Dear {}, Your current balance is {}$' print(text.format(name, bal...
true
4d481d84dfbec66ea490cdaf67c3ea8a359a3e6c
huda29/python--project
/day30.py
504
4.375
4
# Python Loops 3 # For Loop #The range() Function for x in range(6): print(x) #Using the start parameter for x in range (2, 6): print (x) #Increment the sequence with 3 for x in range (5, 40, 5): print(x) #Else in For Loop for x in range(4): print(x) else: print("final...
true
912f3c6e59b5c9d8bc49621cd5b07ae87298a59d
venksj/python-snippets
/second.py
420
4.125
4
# functions def isPrime(x): for i in range (2, x/2): if (x%i == 0): #print str(x) + " IS NOT prime" print x,"IS NOT a prime number" break else: #print str(x) + " IS a prime number" print x, "IS a prime number" num = 1 while(num > 0): num = input...
true
cb1625c51a0c4187488b21f5418b9420145ce7d2
yorkypy/selise-intervie
/problems/freqSort.py
502
4.125
4
#Given a string, sort it in decreasing order of its frequencies def freqSort(string): dict={} for i in range(len(string)): key=string[i] if key not in dict: dict[key]=1 else: dict[key]+=1 sorted_dict={} for j in sorted(dict, key=dict.get, reverse=True): ...
true
2b2165650619ceadd4701e11b98141a2760d3822
sainaadira/python
/app-brewery/07-beginner/hangman/part-1.py
782
4.21875
4
""" ####################################################### hangman tasks: part 1 ####################################################### """ # Step 1 import random word_list = ["aardvark", "baboon", "camel"] # 1 - Randomly choose a word from the word_list and assign it to a variable called chosen_word. chosen_word ...
true
f51b217a4bd0bdba6d8187f11aa3086796411237
sainaadira/python
/app-brewery/08-beginner/caesar_cipher/part1-encryption.py
1,775
4.34375
4
""" ####################################################### caesar cipher part 1 encrypting the message ####################################################### """ # adding alphabet twice to this list for letter that are close to the end, shift can loop back to beginning alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g'...
true
6b069fae730a41a8bfc4bbe083da39a6e28dc273
chikechris/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
783
4.1875
4
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' word = "marathonthon" def count_th(word): # If word is empty, ...
true
443a6f604af952b5acb8868850d17d68d9b338b1
khans/ProgrammingAndDataStructures
/python/Random_1to7.py
427
4.125
4
# Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7. def randomGenerator(input): if(len(input)%7==0): return 1 else: return ((len(input)%7) + 1) print (randomGenerator("")) print (randomGenerator(...
true
8cba987157f15d0cd8d789192d160e2f09d1643b
milk18556/my-script_001
/input.py
261
4.125
4
# Output a string and a variable value. print("Welcome" ,user) #Initialize another variable with a user-specified value. lang = input("Favorite programming language?:") # Output a string and a variable value. print(lang,"Is" ,"Fun", sep="*",end ="!\n")
true
a924d0fdc06941be266cb58c4dbd50fdc3e51802
lmushkat/astr-119-hw-1
/data-types-cont.py
791
4.1875
4
#string s = "I am a sting." print(type(s)) # will say str #Boolean yes = True #Boolean true print(type(yes)) no = False #Boolean False print(type(no)) #List -- ordered and interchangeable alpha_list = ["a", "b", "c"] #list initialization print(type(alpha_list)) #will say tuple print(type(alpha_list[0])) #will...
true
d5b3f69d73a683ef5c83cecca2eb435455ef0972
heihachi/Coding-Projects
/Python/homework/homework_12.py
1,903
4.46875
4
#homework 12 #Programmer James Bishop #Date October 2, 2013 #Purpose: Uses Vigenere Cipher to encrypt raw text. #debug = [] def vigenere(function, text, key): # requires a string and a key text = text.replace(" ", "").upper() # replace the spaces with a NULL character and convert all to uppercase key = key....
true
1951051387815e3e88d2bc9c7c9fe0b60c25cf14
AIRob/Python-for-Finance
/Numpy_Arithmetic_Operations.py
939
4.21875
4
#!/usr/bin/env python # Arithmetic operations import numpy as np def test_run(): a = np.array([(1, 2, 3, 4, 5), (10, 20, 30, 40, 50)]) print "Original array a:\n", a # Multiply a by 2 # When you multiply an array a new one is created and old one is unchanged print "\nMultiply a by 2:\n", 2 * a ...
true
bbb51de592450fdf85217e908c728c2b48d0db48
ver0nika4ka/PythonCrashCourse
/7.2_Restaurant_Seating.py
244
4.375
4
# Program asks the user how many people are in their dinner group. people = input("How many people in your dinner group?") people = int(people) if people > 8: print("\n You need to wait for a table.") else: print("Your table is ready!")
true
196cb521b8abf7cac2b8f6585b09451b1c0a05bb
ver0nika4ka/PythonCrashCourse
/4.10_Slices.py
513
4.4375
4
# Print the message The first three items in the list are:. # Then use a slice to print the first three items from that program’s list. languages = ['russian', 'belarusian', 'english', 'japanese','french'] print("The first three items in the list are: ") print(languages[:3]) # Three items from the middle of the list a...
true
bc836cdb8c2e70c282c014358b436e8200e23be8
ver0nika4ka/PythonCrashCourse
/7.3_Multiples_of_ten.py
334
4.46875
4
# Ask user for a number, report whether the number is a multiple of 10 or not. number = input("Please enter a number and I will tell you number is a multiple of 10 or not: ") number = int(number) remainder = number % 10 if remainder == 0: print(f"{number} is multiple of 10.") else: print("Your number is NOT mul...
true
7553dd71946bb5eef7950dca09eaebbcd3279fd0
Ruqaiyah22/classCode
/lab_3part2.py
2,304
4.65625
5
# # PRACTICE WITH LISTS # print("") # STEP 2 || Create a list with the city names provided cities = [ "Oakland", "Atlanta", "New York City", "Seattle", "Memphis", "Miami", "Boston", "Los Angeles", "Denver", "New Orleans" ] print(*cities, sep = "\n") print("") # STEP 3 |...
true
147e13fb9419fcdf2e142b583c0ec6233905cb15
SamuelSYLee/Elevator
/elevator.py
1,161
4.15625
4
from time import sleep current_floor = 5 # Current floor Lower = 1 # Upper floor Upper = 7 # Lower floor ask_flag = False # Floor-asking flag target_floor = 5 # Target floor while True: while (target_floor < Lower) or (target_floor > Upper) or (target_floor...
true
ef929883d91c161f50cc7eeb028e0ae0ccd3992f
grdguez/learning_python
/repeat_echo.py
552
4.5625
5
#!/usr/bin/env python3.6 # Prompts the user for a message to echo. # Prompts the user for the number of times to repeat the message. If no response is given, then the count should default to 1. # Defines a function that takes a message and count then prints the message that many times. message = input("Enter a message...
true
3c8b8059cf2af3b239d3d263022aa90e3f5d5738
Dreamer123-shekhar/Consultadd-Assignment
/Task3.py
2,311
4.3125
4
#Task Three #Data Structures ''' 1. Create a list of 10 elements of four different data types like int, string, complex and float''' new_list = ['s',1,complex(1,3),True,1.0,2.0,'Shekhar',3,False,'abc'] print(new_list) '''2. Create a list of size 5 and execute the slicing structure''' a = [1,2,3,4,5] new_var = a[0:4]...
true