blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
655652ddbc5ff290cbb0a1fe70aaf06d8bcbd2c0
mingyyy/crash_course
/week2/viernes/class_9_8.py
981
4.3125
4
''' 9-8. Privileges: Write a separate Privileges class . The class should have one attribute, privileges, that stores a list of strings as described in Exercise 9-7 . Move the show_privileges() method to this class . Make a Privileges instance as an attribute in the Admin class . Create a new instance of Admin and use ...
true
73700d1140b8d8e53f91a673248435bde5f65007
mingyyy/crash_course
/week2/jueves/class_9_3.py
1,033
4.59375
5
''' 9-3. Users: Make a class called User . Create two attributes called first_name and last_name, and then create several other attributes that are typically stored in a user profile . Make a method called describe_user() that prints a summary of the user’s information . Make another method called greet_user() that pri...
true
7617579a48dabff19c4bc3ddb7e7e7822db5ff03
mingyyy/crash_course
/week2/miercoles/8-3.py
555
4.59375
5
''' 8-3. T-Shirt: Write a function called make_shirt() that accepts a size and the text of a message that should be printed on the shirt . The function should print a sentence summarizing the size of the shirt and the message printed on it . Call the function once using positional arguments to make a shirt . Call the f...
true
c0a2fbaebf0efe9c0eae3dea677264bd759e6b91
mingyyy/crash_course
/week1/GuestList.py
472
4.21875
4
''' 3-4. Guest List: If you could invite anyone, living or deceased, to dinner, who would you invite? Make a list that includes at least three people you’d like to invite to dinner . Then use your list to print a message to each person, inviting them to dinner . ''' guests = ["Buddha", "Guassian", "Poisson"] for i in...
true
8ea04f8f0537d507c15511a4a103f8b1a2fbf6f1
mingyyy/crash_course
/week3/lunes/chap10_10.py
1,169
4.125
4
''' 10-10. Common Words: Visit Project Gutenberg (http://gutenberg.org/ ) and find a few texts you’d like to analyze . Download the text files for these works, or copy the raw text from your browser into a text file on your computer . You can use the count() method to find out how many times a word or phrase appears in...
true
3f0d2e755d26bc66570fb3fd1d2076d61982229e
Illugi317/forritun
/mimir/assignment2/3.py
518
4.1875
4
''' Write a program that reads in 3 integers and prints out the minimum of the three. ''' num1 = int(input("First number: ")) # Do not change this line num2 = int(input("Second number: ")) # Do not change this line num3 = int(input("Third number: ")) # Do not change this line # Fill in the missing code below ...
true
29fce86b38d0a1d2e25c61a7b388ecd7cc2d9ed0
Illugi317/forritun
/mimir/13/1.py
1,241
4.21875
4
'''Write a program that asks for a name and a phone number from the user and stores the two in a dictionary as key-value pair. The program then asks if the user wants to enter more data (More data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits. Finally, it stores the dictiona...
true
19271efb3151367a8411a66d29fa72376a7b5ba9
Illugi317/forritun
/mimir/10/2.py
890
4.1875
4
''' Write a program that makes a list of the unique letters in an input sentence. That is, if the letter "x" is used twice in a sentence, it shouild only appear once in your list. Neither punctuation nor white space should appear in your list. The letters should appear in your list in the order they appear in the in...
true
ed5273b38d45704cd164f2fafd939e8e57264a66
Illugi317/forritun
/mimir/17/2.py
1,432
4.125
4
''' 2. Sentence 5 points possible Implement a class called Sentence that has a constructor that takes a string, representing the sentence, as input. The class should have the following methods: get_first_word(): returns the first word as a string get_all_words(): returns all words in a list. replace(inde...
true
0d5a143820fe0c434b581faadfafa31ff9fe4e3b
Illugi317/forritun
/mimir/assignment3/3.py
364
4.125
4
''' Write a program using a while statement, that given a series of numbers as input, adds them up until the input is 10 and then prints the total. Do not add the final 10. ''' summ = 0 while True: num = int(input("Input an int: ")) # You can copy this line but not change it if num == 10: ...
true
dcc6bf25956533d61c25830783d07cefd4c83090
Illugi317/forritun
/mimir/assignment1/3.py
330
4.15625
4
''' Write a program that: Takes an integer n as input Adds n doubled to n tripled and prints out the result Examples: If the input is 2, the result is 10 If the input is 3, the result is 15 If the input is 4, the result is 20 ''' n_str = int(input('Input n: ')) print(n_str*2 + ...
true
2bf3b0acc2f35b2c7df93af116c8c8722336d1e1
Illugi317/forritun
/mimir/assignment1/5.py
551
4.46875
4
''' BMI is a number calculated from a person's weight and height. The formula for BMI is: weight / height2 where weight is in kilograms and heights is in meters Write a program that prompts for weight in kilograms and height in centimeters and outputs the BMI. ''' weight_str = input("Weight (kg): ") # d...
true
66321184d6f6c1a8d910920b83bc7968f22d0695
Illugi317/forritun
/mimir/assignment4+/2.py
1,849
4.6875
5
''' Let's attempt to draw a sine wave using the print() statement. Sine waves are usually drawn horizontally (left to right) but the print() statement creates output that is ordered from top to bottom. We'll therefore draw our wave vertically. Our program shall accept two arguments: number_of_cycles - whi...
true
33b46891082bf7233f853dfc38d160b03cccce69
Illugi317/forritun
/mimir/12/3.py
1,140
4.4375
4
''' This program builds a wordlist out of all of the words found in an input file and prints all of the unique words found in the file in alphabetical order. Remove punctuations using 'string.punctuation' and 'strip()' before adding words to the wordlist. Make your program readable! Example input file test.txt: the ...
true
2f1aff649c38537c56124dd7b9c3d712f6f232ce
spencerhhall/phone-codes
/convert.py
1,058
4.15625
4
# Dictionary containing the number associated with each part of the alphabet ASSOCIATIONS = {"abc": 2, "def": 3, "ghi": 4, "jkl": 5,"mno": 6,"pqrs": 7,"tuv": 8, "wxyz": 9} # wordlist: array that contains all words from the wordlist that are the desired length def convertToNumbers(wordlist): combos = {} for word in ...
true
b36d2bbf9bc1c219b9d6191eb912b13012a227bb
samirsaravia/Python_101
/Bootcamp_2020/challenges/question_2.py
251
4.125
4
""" Question 2 Write python code that will create a dictionary containing key, value pairs that represent the first 12 values of the fibonacci sequence """ s = 35 a = 0 b = 1 d = dict() for i in range(s + 1): d[i] = a a, b = b, a + b print(d)
true
056ca0c2bd5d5f3a6ff11e9fbf28b6f8445f1a8c
samirsaravia/Python_101
/Bootcamp_2020/files_and_functions/challenges/3.py
335
4.3125
4
""" Question 3 Write a function to calculate a to the power of b. If b is not given its default value should be 2.Call it power """ def power(a, b=2): """ :return: returns the power of a**b. by default b is 2 """ return a ** b print(f'4 to the power of 3 gives {power(4,3)}') print(f'Inputting 4 give...
true
e15b9185e9c602cda06553aa7dc9aca671acdf6f
PythonStudy/CorePython
/Exercise/Chapter8/8_4_PrimeNumbers.py
861
4.5
4
#coding=utf-8 """ Prime Numbers. We presented some code in this chapter to determine a number’s largest factor or if it is prime. Turn this code into a Boolean function called isprime() such that the input is a single value, and the result returned is True if the number is prime and False otherwise. """ def i...
true
e14d8667012aa8a66efe76bcff3b2a459633a2b2
PythonStudy/CorePython
/Exercise/Chapter8/8_7_PefectNumber.py
1,193
4.125
4
#coding = 'utf-8' #Exercise 8.7 """ Perfect Numbers. A perfect number is one whose factors (except itself) sum to itself. For example, the factors of 6 are 1, 2, 3, and 6. Since 1 + 2 + 3 is 6, it (6) is considered a perfect number. Write a function called isperfect() which takes a single integer input and ou...
true
6764bb9e4f541c46872550d6f60f04b3c4c8c141
KHungeberg/Python-introcourse
/C4Assignment4E (2).py
1,008
4.125
4
# Assignment 4E: Bacteria growth: import numpy as np import math as ma # Write a program that simulates the bacteria growth hour by hour and stops when the number of bacteria exceeds # some fixed number, N. Your program must return the time t at which the population first exceeds N. Even # though the actual numbe...
true
80f5f93884735da50dcf50c2438a400a2f387974
KHungeberg/Python-introcourse
/C3Assignment3C.py
701
4.1875
4
#ASSIGNMENT 3C # Write a function that takes as input two unit vectors v1 and v2 representing two lines, and computes the acute # angle between the lines measured in radians. # First we import math and numpy import math as m import numpy as np # The formula for calculating the angle between 2 unitvector...
true
e77faccfbf6c28f62145b4a70414217f7ca9a873
jamiebrynes7/advent-of-code-2017
/day_3/challenge1.py
1,037
4.125
4
import sys import math def main(): # Get input arguments. try: target_square = int(sys.argv[1]) except IndexError: print("Usage: python challenge1.py <target_square>") exit(1) # Get the closest perfect odd square root (defines dimensions of the square) closest...
true
de22af72c9b8d49040639b5e4c05c78ef9b15a9e
rohitraghavan/D05
/HW05_ex09_01.py
674
4.15625
4
#!/usr/bin/env python3 # HW05_ex09_01.py # Write a program that reads words.txt and prints only the # words with more than 20 characters (not counting whitespace). ############################################################################## # Imports # Body def read_check_words(): """This method reads a file and p...
true
21bd0fa289fe626e6d52a6328225af89bbac7217
tomvangoethem/toledo
/03_find_triplets/find_triplets.py
1,285
4.125
4
""" Write a program that takes a list of integer numbers as input. Determine the number of sets of 3 items from the list, that sum to 0. E.g. if the list = [5, -2, 4 , -8, 3], then there is one such triplet: 5 + (-8) + 3 = 0. For larger lists, the number of triplets probably will be much higher. If the list would con...
true
22909c205fde49807b154925facd55aee51edc55
MCHARNETT/Simple-Projects
/fibonacci.py
618
4.5
4
# -*- coding: utf-8 -*- """ Created on Wed Jul 26 11:07:59 2017 @author: harne """ import sys def fibonacciSeries(n): ''' n is the range of values that the program will calculate the series up to. returns a list of the fibbonaci numbers in that range. ''' fibbonaci_numbers = [1, 1] ...
true
1539fb30613474a6a14579b40bca98431b3cab79
YeashineTu/HelloWord
/game.py
859
4.21875
4
#!/usr/bin/python #-*- coding utf-8 -*- #date:20171011 #author:tyx #==== 点球小游戏 ==== def isRight(value,list): if value not in direction: print('Your direction is not right,input again') return False else: return True def isEqual(value1,value2): if(value1==value2[0]): print("sorry,you lost the score") retur...
true
dd104ea65ffd608e4d34783422e77e3aab2caf5b
lostarray/LeetCode
/027_Remove_Element.py
1,127
4.15625
4
# Given an array and a value, remove all instances of that value in place and return the new length. # # Do not allocate extra space for another array, you must do this in place with constant memory. # # The order of elements can be changed. It doesn't matter what you leave beyond the new length. # # Example: # Given i...
true
71b64e10176d739cd899624a4ece18d2369a4053
Aehlius/CS-UY_1134
/HW/HW4/ia913_hw4_q4.py
1,154
4.28125
4
import BST_complete def create_chain_bst(n): # this function creates a degenerate tree with all right children from 1 to n chain_tree = BST_complete.BST() for i in range(n): # since the loop will insert larger values as it continues, all children will be right chain_tree.insert(i+1) re...
true
04ec80a89fb31219728371330989b67900b00977
JasperMi/python_learning
/chapter_04/pizzas.py
416
4.21875
4
pizzas = ['seafood pizza', 'cheese pizza', 'beef pizza'] # 创建副本 friends_pizzas = pizzas[:] pizzas.append('chicken pizza') friends_pizzas.append('corn pizza') # for pizza in pizzas: # print("I like " + pizza) print("My favorite pizzas are:") for pizza in pizzas: print(pizza) print("\nMy friends favorite pizz...
true
511c7189863776d385c52fdb088c37d1555a87fc
sushmita-2001/Python-p2p-programming-classes
/calc.py
685
4.4375
4
print('Welcome to the calculator world!!') print('Please type the math operation you want to complete') print("+ for addition \n - for subraction \n * for multiplication \n / for division \n ** for power \n % for modulus") num1 = int(input('Enter the first number: ')) num2 = int(input('Enter the second number: '...
true
e0a8234f3f2c1eb5e0c20c24f561971ad4d701e7
nakinnubis/abiola_akinnubi_test
/QuestionIsOverlapProgram python version/isoverlap.py
1,267
4.25
4
import sys #this lambda converts string to float since python does not have decimal tofloat = lambda x:float(x) #this converts inputs to array but calls the tofloat method on each inputs def InputToArray(inpt): values = [] listvalue = inpt.split(',') for inp in listvalue: values.append(tofloat(inp))...
true
c721ff8e28c36253644f4893cf75f6a69e0040ed
prafful/python_jan_2020
/32_threads.py
818
4.25
4
""" thread as smallest unit of execution! multithreading thread module (depreceated) (python 3+ has _thread to support backward compatibility!) threading module """ import _thread import time def callMeForEachThread(threadName, delay): counter = 0 while counter<=5: print(threadName," ...
true
42c32fe289ab0c5534b4332592cd6e88371e05a6
prafful/python_jan_2020
/22_oops_class.py
960
4.28125
4
''' class instance attributes class attributes self __init__ ''' #create custom class in python class Vehicle: vehicleCount = 0 #constructor def __init__(self, color, vtype): print("I am in constructor!") self.color = color self.vtype = vtype Vehicle.vehicleCount += 1 ...
true
5c6f3e64420a0c773c93c7e3c7711544a52a3c76
yeazin/python-test-tutorial-folder
/csv input tutorial/reading csv.py
496
4.21875
4
#reading CSV file import csv with open('csvfile.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') dates=[] colors=[] for row in readCSV: ''' print('') print(row[0],row[1],row[2],row[3]) ''' color=row[3] date=[0] dates.append(date) colors.append(color) print(dates) print(colors) ...
true
ac563df061b4ac6abd833d73f5bcfa66cd06851a
ngirmachew/data-structures-algorithms-1
/CtCI/Ch.1 - Arrays & Strings/1.6string_compression.py
769
4.28125
4
def string_compression(input_string): # takes care of upper and lower case -> all to lower # example: given aabcccccaaa shoud return -> a2b1c5a3 input_string = input_string.lower() count = 1 # string that is used to store the compressed string compressed_str = "" for i in range(len(input_str...
true
3efb6832abc42063722faa7e3fe006e06978abbf
mollyocr/learningpython
/practicepython/exercise6.py
1,057
4.46875
4
### 2018-10-29 mollyocr #### practicepython.org exercise 6: string lists ## Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.) string_to_eval = input("Hi! Enter a string. I'll tell you if it's a palidrome or not. "...
true
75d3fed54c68a294785a43e57f068d2bee765c5c
mollyocr/learningpython
/practicepython/exercise4.py
1,340
4.4375
4
#### 2018-10-25 mollyocr #### practicepython.org exercise 4: divisors ## Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (A divisor is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder.) ...
true
73f3882babca313f137eff0892e8ef9ebc41bf2a
imushir/qxp_python_class_july_2019
/QuickxpertPython-master/13042019/class/example_scdnd.py
2,058
4.3125
4
class Employee: """ This Employee class """ company_name = "Quickxpert" # class variable def __init__(self): """ This is constructor of class Employee. Initializes the attribute values. :returns: None :rtype: None :author: Qxpert """ ...
true
e7f673bf317a07788ef32be89ed6f81f3669b9e4
hsingh08/Python-Programming
/Source Codes/Lecture 1 Excersies/areaof circle.py
224
4.125
4
import math num1String = input('Please enter the radius of the circle: ') Radius = int(num1String) AOC=math.pi*Radius*Radius CF=2*math.pi*Radius print ("Area of the Circle is",AOC) print ("Circumference of the Circle is",CF)
true
b66153a0db603adce890f8d50bd248b01bf5fc00
aditp928/cyber-secruitiy-
/4-OldFiles/Unit03-Python/2/Activities/02-Ins_IntroToDictionaries/dictionaries.py
1,260
4.625
5
# Creating a dictionary by setting a variable equal to "keys" and "values" contained within curly brackets pet = { # A key is a string while the value can be any data type "name": "Misty", "breed": "Mutt", "age": 12 } print(pet) # A single value can be collected by referencing the dictionary and then u...
true
9b5f0f216ed287ff1e2267aa856958a9ae7fa303
aditp928/cyber-secruitiy-
/1-Lesson-Plans/Unit03-Python/4-Review/Activities/11-Par_Inventory/Unsolved/inventory_collector.py
574
4.5
4
# TODO: Create an empty dictionary, called inventory # TODO: Ask the user how many items they have in their inventory # TODO: Use `range` and `for` to loop over each number up to the inventory number # TODO: Inside the loop, prompt the user for the name of an item in their inventory ("What's the item? ") # TODO: The...
true
ab2f60bce0d8db79d03bb4b9c9d9816c05ecd5ff
aditp928/cyber-secruitiy-
/1-Lesson-Plans/Unit03-Python/2/Activities/07-Stu_FirstFunctions/Solved/Length.py
221
4.21875
4
# function to get the length of an item def length(item): count = 0 for i in item: count = count + 1 return count print(length("hello")) print(length("goodbye")) print(length(["hello", "goodbye"]))
true
3b15c02306cdef261e92a40b878fdacec5c135b2
aditp928/cyber-secruitiy-
/4-OldFiles/Unit03-Python/2/Activities/08-Ins_WritingFiles/WriteFile.py
819
4.34375
4
# Not only can Python read files, it can also write to files as well # The open() function is used once more but now "w" is used instead of "r" diary_file = open("MyPersonalDiary.txt", "w") parts_of_entry = ["Dear Diary,", "\n", "Today I learned how to write text into files using Python!", ...
true
516293e2fd7545225d84ff047c0bb3a0c86668e3
aditp928/cyber-secruitiy-
/4-OldFiles/Unit03-Python/1/Activities/06-Ins_ForLoops/ForLoops.py
1,044
4.4375
4
hobbies = ["Rock Climbing", "Bug Collecting", "Cooking", "Knitting", "Writing"] weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] # Looping through the values in a list for hobby in hobbies: print(hobby) print("-------------") # It is possible to loop through the length of a list numerically to...
true
853baa71b9e872547c8bd04cc6186da5dd62c3f9
UmarAlam27/Python_beginner_learning_
/faulty calc by nikhil.py
1,592
4.3125
4
#Exercise #Design a calculator which will correctly solve all the problems except.. #..the following ones # 45 * 3 = 555, 56 + 9 = 77, 56/6=4 # ...Your program should take operator and the two numbers as input from user and return the result # making a faulty calculator while(True): print ("Enter r...
true
ab2d511cd408d4bc7cf645a9088a9fc095ca89ae
SatishEddhu/Deep-Analytics
/Python Basics/dictionary.py
712
4.28125
4
# Dictionary is a mutable object map1 = {"key1":10, "key2":20, "key3":30} type(map1) # dict print map1 map1.keys() # Two ways of getting values from map map1.get("key3") map1["key3"] # modifying map has a concise syntax map1["key4"] = 70 # adding new key map1["key2"] = 90 # can also modify values of existing keys #...
true
ba19426155017d3320c68bb3682c0a11f12bb0f6
FarazMannan/Roulette
/Roulett.py
1,546
4.375
4
# random number gen. import random # intro to the game print("") # adding and subrtacting system # bank bank = 500 # asking the player to enter one of 3 color choices (input) keep_gambling = True while keep_gambling == True: color_selected = input("What color would you like to pick? ") color_selected = ...
true
90ccf10cb639c66df875fa03cbba2aa42d10fab4
mparab01/Python_Assignment
/Assignment1.py
1,409
4.40625
4
# coding: utf-8 # Q. Print only the words that start with s in this sentence # In[1]: s = 'Print only the words that start with s in this sentence' # In[2]: for i in s.split(): if i[0]=='s': print i # Q. Use range to print all even numbers from 0 to 10 # In[4]: l = range(0,11,2) print l # ...
true
8c995a9cf354f361d5acd4f424b2feb1f02688f6
moni310/function_Questions
/3_or_5_sum.py
257
4.15625
4
def limit(parameter): n=num sum=0 while 0<n: number=int(input("enter the number")) if number%3==0 or number%5==0: sum=sum+number n=n-1 print(sum) num=int(input("enter the number")) limit( num)
true
9f29a197c7637ee528024896ba3ddf0c417148ca
moni310/function_Questions
/string_length.py
350
4.125
4
def string_function(name,name1): if len(name)>len(name1): print(name,"name length is more than name1") elif len(name)<len(name1): print(name1,"name1 length is more than name") else: print("name1 and name is equal") name=input("enter the any alpha") name1=input("enter the any alpha") ...
true
54deb48c6c2f13d940817f8a3d8cca0656b32e0b
tylercrosse/DATASCI400
/lab/01-03/L02-2-ListDict.py
1,897
4.40625
4
""" # UW Data Science # Please run code snippets one at a time to understand what is happening. # Snippet blocks are sectioned off with a line of #################### """ # DataStructures (built-in, multi-dimensional) # Documentation on lists and other data structures # https://docs.python.org/3/tutorial/datas...
true
83d3f06d181c8b3ab1e0f3d9ab961eb4b730a3ce
tylercrosse/DATASCI400
/lab/04/L04-B-1-DataTypes.py
1,536
4.21875
4
""" # UW Data Science # Please run code snippets one at a time to understand what is happening. # Snippet blocks are sectioned off with a line of #################### """ """ Data Types """ # Create an integer x = 7 # Determine the data type of x type(x) ################# # Add 3 to x x + 3 #######...
true
7c551f2f830d950126c1095262818ddc1e0d51c5
tylercrosse/DATASCI400
/assignments/TylerCrosse-L04-NumericData.py
1,629
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Lesson 04 Assignment Create a new Python script that includes the following for your Milestone 2 data set: - Import statements - Load your dataset - Assign reasonable column names, the data set description - Median imputation of the missing numeric values - Outlier re...
true
8c692414bfd4ca0d1af8c086e8944b552c27cedf
JnthnTrn/my-first-python-project
/Set.py
972
4.1875
4
# names = {"tyler", "jacky", "ramiro", "kingsley"} # print("jacky" in names) #names[0] makes no sense #looping through set with a for loop #for name in names: #elements in sets cannot be changed #Changing a list #names = ["tyler", "jacky", "ramiro", "kingsley"] # names[2] = "jordan" #adding new elements to a set: ...
true
25c6fa624f1b915e388b49beafff4add2d5a8421
Nadineioes/compsci-jmss-2016
/tests/t1/sum2.py
322
4.125
4
# copy the code from sum1.py into this file, THEN: # change your program so it keeps reading numbers until it gets a -1, then prints the sum of all numbers read numbers = [] num = 0 while num != -1: num = input('number: ') num = int(num) if num != -1: numbers.append(num) sum = sum(numbers) print(su...
true
dbf2b0caf4936965364dfbc0892131978aafe05f
Niloy009/Python-Learning
/hello_you.py
421
4.34375
4
# ask user name name = input("What is your name?: ") #ask user age age = input("What is your age?: ") #ask user city city = input("Where do you live in?: ") #ask user what they enjoy? love = input("What do you love to do?: ") #create output string = "Your name is {} and you are {} years old. You are from {} & ...
true
cca31d36b2890feea13506a2d934a0fd68162c63
xaviercallens/convex-optimization
/tools.py
684
4.21875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Some tools. """ __version__ = "0.1" __author__ = "Nasser Benabderrazik" def give_available_values(ls): """ Give the available values in ls as: "value1 or value2 or value3 ...". This is used for printing the available values for string variables in a fun...
true
c463cec2b899361c5b989619e50d81831be29989
ml5803/Data-Structures-and-Algorithms
/Data Lecture/9-27-RecursionContinued.py
1,846
4.375
4
''' start assumption with WHEN CALLING ''' def count_up3(start,end): if start == end: print(start) else: count_up3(start,(start+end)//2) count_up3((start+end)//2+1,end) # when calling countdown on a smaller range # it would print the numbers in that range in a decreasing order def coun...
true
5b0c8fc9f82e9e39c9ee7a1d6f9ee9687aea3281
filmote/PythonLessons
/Week2_4.py
956
4.125
4
import turtle def polygon(aTurtle, sides, length): counter = 0 angle = 360 / sides while counter < sides: aTurtle.right(angle) aTurtle.forward(length) counter = counter + 1 # ------------------------------------------------- # set up our shapes # triangle = { "name": "Triangle"...
true
e97520c28a8f47624740a39aec5aa01fa8857db7
JaydeepUniverse/python
/projects/gameBranchesAndFunctions.py
2,974
4.21875
4
from sys import exit def start(): print """ Welcome to my small, easy and fun game. There is a door to your right and left. Which one would you take ? Type right or left. """ next = raw_input("> ") if next == "left": bear_room() elif next == "right": evil_room() else...
true
c95ff9f7a74cf4d9973f1e0f006a42840348539c
sminix/spongebob-meme
/spongebob.py
876
4.15625
4
''' Take input string and output it in the format of sarcastic spongebob meme Sam Minix 6/23/20 ''' import random lower = 'abcdefghijklmnopqrstuvwxyz' upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def spongebob(text): newText = '' #initialize new text choice = [True, False] #initialize choices for i in range(le...
true
51d992a4447fd815d2241e74f33dd95da622ec1c
detcitty/100DaysOfCode
/challenges/kaggle/python-course/ex4.py
715
4.21875
4
def multi_word_search(doc_list, keywords): """ Takes list of documents (each document is a string) and a list of keywords. Returns a dictionary where each key is a keyword, and the value is a list of indices (from doc_list) of the documents containing that keyword >>> doc_list = ["The Learn Pytho...
true
be0696e5dbdc94185fd09ec087f83d7787b2492c
detcitty/100DaysOfCode
/python/unfinshed/findTheVowels.py
559
4.3125
4
# https://www.codewars.com/kata/5680781b6b7c2be860000036/train/python ''' We want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters). So given a string "super", we should return a list of [2, 4]. Some examples: Mmmm => [] Super => [2,4...
true
48bf51edf36127d6023eb16353cea66bd56e4159
detcitty/100DaysOfCode
/python/unfinshed/tribonacci_sequence.py
2,370
4.53125
5
# https://www.codewars.com/kata/556deca17c58da83c00002db/train/python ''' Well met with Fibonacci bigger brother, AKA Tribonacci. As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, worse part of it, regrettabl...
true
55cfcefef97312fa2cd309f8cdc071128ed4f478
yewei600/Python
/Crack the code interview/Minesweeper.py
846
4.21875
4
''' algorithm to place the bombs placing bombs: card shuffling algorithm? how to count number of boms neighboring a cell? when click on a blank cell, algorithm to expand other blank cells ''' import random class board: dim=7 numBombs=3 bombList=[None]*numBombs def __init__(self): print "let's ...
true
9b9b89a566210fb165d1967f137a237f3817fa7e
yewei600/Python
/Crack the code interview/bit manipulation/pairwiseSwap.py
449
4.1875
4
def pairwiseSwap(num): #swap odd and even bits in an integer with as few instructions as possible tmp=0 num=bin(num) num=num[2:] num=list(num) if len(num)%2: num.insert(0,'0') print("before swapping: "), print num for i in range(0,len(num),2): tmp=num[i] num[...
true
ee09a52cebcbbd5889a0f2a227672ac42e1c9cc3
DerryPlaysXd/learn-python-basics
/Python Files/01-variables.py
568
4.40625
4
""" Welcome to the first course of the Learn-Python-Basics project! Here you will learn how to create a new variable, print the variable out and do some basic math! """ # First of all let's create a variable: aVar = 3 # We can print aVar out with the following line: print(aVar) # We can also do some calculations us...
true
8dc4ebaf99230ef7580ab39d1860e21dbe745b7b
andrewsanc/pythonOOP
/exerciseCatsEverywhere.py
691
4.34375
4
# Python Jupyter - Exercise: Cats Everywhere #%% #Given the below class: class Cat: species = 'mammal' def __init__(self, name, age): self.name = name self.age = age # 1 Instantiate the Cat object with 3 cats #%% cat1 = Cat('Grumpy Cat', 2) cat2 = Cat('Keyboard Cat', 1) cat3 = Cat('Garfield', ...
true
4b9764b1034df16e9a0fb1315298b8103d92184d
SiTh08/python-basics
/Exercises/Exercise1.py
1,213
4.5625
5
# Define the following variables # first_name, last_name, age, eye_colour, hair_colour first_name = 'Francis' last_name = 'Thevipagan' age = 25 eye_colour = 'Brown' hair_colour = 'Black' # Prompt user for input and Re-assign these first_name = input('What is your first name?').capitalize().strip() print(first_name) l...
true
278d3be29a6dc8c5af985c0fcdbe24d39a4f84f7
sharmayuvraj/cracking-the-coding-interview
/linked-lists/loop-detection.py
704
4.125
4
""" Given a circular linked list, implement an algorithm that return the node at the begining of the loop. DEFINITION Circular linked list: A (corrupt) linked list in which a node's next pointer points to an earlier node, so as to make a loop in the linked list. Example: Input: A -> B -> C -> D -> E -> C [the same C...
true
afa178c6451ff803e343f8e3a238a69e0cd0369e
congnbui/Group3_Project
/Homeworkss5/Hwss4.study.4.9.8.py
246
4.28125
4
def area_of_circle(r): """area of a circle with radius r""" import math a = math.pi * (r**2) return a ##import math while True: r = int(input("Enter the radius: ")) print("The area of the circle is: ",area_of_circle(r))
true
9bc65899c5ee88b5972df5d1215b4ae85ef57db8
yogeshdewangan/Python-Excersise
/listPrograms/permutation.py
1,074
4.1875
4
""" Write a Python program to generate all permutations of a list in Python """ """ In mathematics, the notion of permutation relates to the act of arranging all the members of a set into some sequence or order, or if the set is already ordered, rearranging (reordering) its elements, a process called permuting. Thes...
true
983427e4b9dbfc51060f5bfddba622c4bc9f2d9d
yogeshdewangan/Python-Excersise
/shallow_and_deep_copy/assignment_copy.py
524
4.25
4
import copy #Copy via assignment #only reference will be copied to new instance. Any modification in new one will reflect on other one #Memory location is same for both the instances print("Assignment copy ----------") l1 = [1,2,3,4] print("L1: " + str(l1)) print("Memory Location L1: "+ str(id(l1)) ) l2= l1 ...
true
d583a40e72833a31104cb1724fdcba8edb4b1c41
jdaeira/Python-Collections
/slices.py
930
4.1875
4
my_string = "Hello there" new_string = my_string[1:5] print(new_string) my_list = list(range(1,6)) print("My list is: {} ".format(my_list)) # This will get the last item of the list new_list = my_list[2:len(my_list)] print(new_list) beginning = my_list[:3] print(beginning) end = my_list[0:] print(end) all_list = ...
true
5d3b35a39d67e1158ea9440ba19230274cb6c3d7
jpmolden/python3-deep-dive-udemy
/section5_FunctionParameters/_66_extended_unpacking.py
1,801
4.34375
4
print('*** Using python >=3.5 ***') l = [1, 2, 3, 4, 5, 6] # Unpacking using slicing, : a, b = l[0], l[1:] print('\n**** Using the * Operator ***') print('\ta, *b = l') a, *b = l print("\ta={}\n\tb={}".format(a,b)) print('\tThis works with any iterable including non-sequence types (set, dict)') c, *d = (1,2,3,4,5...
true
2e2eacf22e11cb41a803a44c0e76827670338018
susantamoh84/Python-Learnings
/python-matplotlib.py
2,073
4.25
4
# Print the last item from year and pop print(year[-1]);print(pop[-1]) # Import matplotlib.pyplot as plt import matplotlib.pyplot as plt # Make a line plot: year on the x-axis, pop on the y-axis plt.plot(year,pop) # Display the plot with plt.show() plt.show() # Change the line plot below to a scatter plot plt.scatt...
true
2ef6f5b9fe8c229905b5e63bc49f46de76dcb16b
ashu20031994/HackerRank-Python
/Day-2-Python-DataStructure/4.Find_percentage.py
1,061
4.21875
4
""" The provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal. Example The query_name is 'beta'. beta's average score is . Input Format The first line ...
true
9b57bb348adca0ef1d41facb467f6042a908f189
Ahmad-br-97/DataMining-Exercise-1
/Exercise_01-04.py
491
4.25
4
text = input("Please enter a comma separated string of words: ") split_text = text.split(',') output_set = set() output_list = [] for word in split_text : output_set.add(word) #Add words to a Set for remove duplicate words for word in output_set : output_list.append(word) #convert Set To List output_list...
true
1ad59660fa739a147a3284fe5cadcd4d9cb4915d
Nutenoghforme/Manatal
/Ex2.py
720
4.15625
4
#Exercise 2: Randomness Test #In a lottery game, there is a container which contains 50 balls numbered from 1 to 50. The lottery game consists in picking 10 balls out of the container, and ordering them in ascending order. Write a Python function which generates the output of a lottery game (it should return a list). A...
true
b176cf4b2b6e44779848af26ccc65076d172158e
AndresRodriguezToca/PythonMini
/main.py
1,755
4.25
4
# Andres Rodriguez Toca # COP1047C-2197-15601 # 10/3/2019 #Declare variables numberOrganisms= 0 dailyPopulation = 0.0 averageIncrease = 0.0 numberDays = 0 counter = 2 #Get the number of organism print("Starting number of organisms:", end=' ') numberOrganisms = int(input()) # If necessary loop through the input until...
true
bf86ec9fc09cb4caa7d9383de96b15e357d7994f
samiulla7/learn_python
/datatypes/dict.py
1,204
4.3125
4
my_dict = {'name':'Jack', 'age': 26} # update value my_dict['age'] = 27 #Output: {'age': 27, 'name': 'Jack'} print(my_dict) # add item my_dict['address'] = 'Downtown' # Output: {'address': 'Downtown', 'age': 27, 'name': 'Jack'} print(my_dict) ##########################################################################...
true
1d75087f26ee00058c26ae5795c2f81af239161f
eltondornelas/hackerrank-python
/text_alignment.py
1,927
4.40625
4
""" In Python, a string of text can be aligned left, right and center. .ljust(width) This method returns a left aligned string of length width. >>> width = 20 >>> print 'HackerRank'.ljust(width,'-') HackerRank---------- .center(width) This method returns a centered string of length width. >>> width = 20 >>> print ...
true
c34a9cea2effc8d23f885d6cb2afc3c5612e819e
Stanbruch/Strong-Password-Checker
/strong_password_check.py
1,132
4.1875
4
import re #strong password passStrong = False def passwordStrength(): #Enter password passwordText = input('Enter password: ') #Strength check charRegex = re.compile(r'(\w{8,})') lowerRegex = re.compile(r'[a-z]+') upperRegex = re.compile(r'[A-Z]+') digitRegex = re.compile(r'[0-9]+') ...
true
27651140b12fd771972ec657b968e37b68a3d0c4
skgande/python
/pythoncoding/com/sunil/functions/print_3_times_each_character.py
832
4.34375
4
class Print3TimesEachCharacter: """ Given a string, return a string where for every character in the original there are three characters. paper_doll('Hello') --> 'HHHeeellllllooo’ paper_doll('Mississippi') --> 'MMMiiissssssiiippppppiii’ """ def __init__(self): return def pr...
true
ad7d1249367d98b1570775c3adbfabaa1e83c909
Henrique-Temponi/PythonForFun
/PythonOtavio/PythonBasic/05-operators.py
781
4.34375
4
""" we have a few operators in python: +, -, *, **, /, //, %, () """ # Both + - are quite simple, the first adds, the second subtracts print(1 + 1) print(1 - 1) # note with +, you add strings together print("bana" + "na") # * = multiples print(2*2) # NOTE: you can multiply strings, with you copy x number of times a...
true
93e2f9044e3c5fbd595cc325171be2892791fbc8
Henrique-Temponi/PythonForFun
/PythonOtavio/PythonBasic/17-split_join_enumerate.py
1,887
4.53125
5
""" Split - this will split a string with the chosen separator, ( default is whitespace ) Join - this will join multiple elements (eg. in a list or a string) enumerate - this will create a index for a iterable object (eg. list, string, dictionary, etc) these function covers a lot of grou...
true
99fef6c9ac257ed5c56df6308f37e9f16d607b3c
KostaPapa/Python_Works
/Practice/a30ClassGeneralForm.py
2,806
4.5
4
class TypeName( object ): '''This class will contain the general form of a class.''' def __init__( self, dataMember_1, dataMember_2, dataMember_3 = 3 ): # defaultValue '''This function will initialize the variables needed to be used during class design. Notice that other variables may be needed ...
true
b5006fe99312946863316ce419427aad74635803
KostaPapa/Python_Works
/LAB/REC02/rec02.0 ( Box ).py
2,468
4.375
4
""" User Name: kpapa01 Programmer: Kostaq Papa Purpose of this program: This program will print a box with a certain width and character. Constrains: It will compile from left to right. The is an integer number. """ def askTheuserToenterCharacter (): '''This function will ask the user to enter a char...
true
1701db222173b6b1c61555835dfa4d345b0cf30a
jkrobinson/crash
/Ch04/friend_pizzas.py
299
4.125
4
pizzas = ['meat lovers', 'hawaiian', 'cheesy'] pizzas.append('supreme') friend_pizzas = pizzas[:] friend_pizzas.append('bbq chicken') print("My favourite pizzas are:") for pizza in pizzas: print(pizza) print("\nMy friend's favourite pizzas are:") for pizza in friend_pizzas: print(pizza)
true
ddc554e34944d80e82ddfc5b3013a989f2026e5b
Surafel-zt/Final-website
/GUI questions.py
1,761
4.21875
4
from tkinter import * from tkinter import messagebox root = Tk() root.title('Assignment 2 GUI') question_1 = Label(root, text="Who lives in the second corner?", font=('Verdana', 12)) question_1.grid(row=0, column=0) question_2 = Label(top, text="Who lives in the middle?", font=('Verdana', 12)) question_2.g...
true
86654923966393893975ca3b0ebcb9ed3720cb09
inwenis/learn_python
/01_print.py
1,298
4.53125
5
print("Hello there human!") print("do you know you can put any text into a print()?") print("like stars *******, numbers: 1,2,42,999") # exercise 1: Use print() to display "Hello world" in the console # Do one exercise at a time. # exercise 2: Use print() to display some asterisks (this is a # asterisk -> * ) # ex...
true
b6ec41689760a4e558bd4605a5fcf99ee9139079
inwenis/learn_python
/08_interactive_shell.py
2,605
4.21875
4
# This file is not about a new part of the python language. It's # about another way to execute python code. # Till now we have execute our python scripts by invoking the python # program from terminal and passing it a script to execute. # If you use PyCharm and run scripts with "right click" + "Run ...." # PyCharm in...
true
68d06770e3db6145a77e8fe1c4fa8515cbbbeb0e
kannan4k/python_regex_implementation
/SubString.py
2,604
4.3125
4
"""Implementation of the Python Programming Contest 1""" from __builtin__ import range def split_string(text): """ This function will split the string into list based on the '*' as delimiter For Ex: input = "Hello*Python" Output = ['Hello', 'Python'] and Yes it will remove t...
true
34a1c766420bf8a0ad3b5074fcfd615a0ae22e06
RichHomieJuan/PythonCourse
/Dictionaries.py
388
4.15625
4
#dictionaries are indexed by keys. dictionary = {} #not very useful tel = {"Mary": 4165, "John" : 4512, "Jerry" : 5555 } print(tel) tel ["jane"] = 5432 #inserts into the dictionary print(tel) print(tel ["Jerry"]) #looks up the specified thing in dictionary del tel["Jerry"] #deletes said person or value. print(tel) ...
true
96644660d0c878ea20b83c708ac773f4e0250a3c
georgetaburca/analog-clock
/analog_clock.py
1,556
4.15625
4
#simple analog clock in Python import time import turtle wn = turtle.Screen() wn.bgcolor("black") wn.setup(width=600, height=600) wn.title("Analog Clock") wn.tracer(0) #Create the drawing pen pen = turtle.Turtle() pen.hideturtle() pen.speed(0) pen.pensize(3) def draw_clock(h, m, s, pen): #...
true
eb0b85afa0d48d3ffd65d74b0448e7aaa2af526e
ssharp96/Comp-Sci-350
/SSharpArithmeticMean.py
316
4.125
4
# Arithmetic Mean # author: SSharp def arithmeticMean(a,b): '''Computes and returns the arithemtic mean of a and b''' return ((a+b)/2) a = float(input("Enter a number: ")) b = float(input("Enter another number: ")) result = arithmeticMean(a,b) print("The arithmetic mean of",a,"and",b,"is",result)
true
a4e4d9ba8286920529b347b58aa34d40a065eb77
MthwBrwn/data_structures_and_algorithms
/data_structures/hash_table/hash_table.py
2,355
4.15625
4
class Hashtable: """ """ def __init__(self): self.size = 64 self.bucket = [None] * self.size def __repr__(self): return f'bucket size : {self.size}' def __str__(self): return f'bucket size : {self.size}' # A hash table should support at least the following methods...
true
87b2555f4151df0cf97d84d3dddd5639d9eb7433
OlehPalka/Algo_lab
/insertion_sort.py
1,068
4.21875
4
""" This module contains insertion sort. """ def insertion_sort(array): """ Insertion sort algorithm. """ for index in range(1, len(array)): currentValue = array[index] currentPosition = index while currentPosition > 0 and array[currentPosition - 1] > currentValue...
true
62d6467157d0a54e20dca9a14ff9d5020c3dbe79
error-driven-dev/Hangman-game
/hangman.py
2,544
4.125
4
import random import string #open text file of words, save as a list and randomly select a word for play def new_word(): with open("words.txt", "r") as word_obj: contents = word_obj.read() words = contents.split() word = random.choice(words) return word def lett...
true
e38f902083d53e2ecdcec7e42d6b0e1bdeb4b7af
dj5353/Data-Structures-using-python
/CodeChef/matrix 90(anticlockwise).py
523
4.375
4
#for matrix 90 degree anticlockwise rotation #and transpose the matrix #reverse matrix all column wise def matrix_rotate(m): print("Matrix before rotation") for i in (m): print(i) # Transpose matrix for row in range(len(m)): for col in range(row): m[row][col], m[c...
true