blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
1ce6ad0a83e82ade475c75c40d9cf5c8fb4cac43
ellen-yan/self-learning
/LearnPythonHardWay/ex5.py
1,363
4.34375
4
my_name = 'Ellen X. Yan' my_age = 23 # not a lie my_height = 65 # inches my_weight = 135 # lbs my_eyes = 'Brown' my_teeth = 'White' my_hair = 'Black' print "Let's talk about %s." % my_name print "She's %d inches tall." % my_height print "She's %d pounds heavy." % my_weight print "Actually that's not too heavy." print ...
true
a6f237792aef743e05e0e1d0f81e510b0926bdec
nsimsofmordor/PythonProjects
/Projects/PythonPractice.org/p2_odd_or_even.py
481
4.40625
4
# Ask the user for a number. # Depending on whether the number is even or odd, print out an appropriate message to the user. # If the number is a multiple of 4, print out a different message. # Ask for a positive number number = int(input("Enter a positive number: ")) while number < 0: number = int(input("Enter ...
true
ee6fcba43821b771900c0ced8ca27003e6085fd0
nsimsofmordor/PythonProjects
/Projects/PythonPractice.org/p6_sting_lists.py
287
4.53125
5
# Ask the user for a string and print out whether this string is a palindrome or not. my_str = str(input("Enter a string to check if it is a palindrome or not: ").lower()) rev_str = my_str[::-1].lower() if my_str == rev_str: print("Palindrome!") else: print("Not Palindrome!")
true
068905cbe2bea0582747af13f294ce98d8edf24f
nsimsofmordor/PythonProjects
/Projects/Python_Tutorials_Corey_Schafer/PPBT5 Dicts.py
1,064
4.375
4
# {Key:value} == {Identifier:Data} student = {'name': 'john', 'age': '27', 'courses': ['Math', 'Science']} print(f"student = {student}") print(f"student[name] = {student['name']}") print(f"student['courses'] = {student['courses']}\n") # print(student['Phone']) # throws a KeyError, sine that key doesn't exist print(...
true
14325d0779ae0aa4b96b89daddcaef7448493106
msossoman/coderin90
/calculator.py
1,165
4.125
4
def add (a, b): c = a + b print "The answer is: {0} + {1} = {2}".format(a, b, c) def subtract (a, b): c = a - b print "The answer is {0} - {1} = {2}".format(a, b, c) def multiply (a, b): c = a * b print "The answer is {0} * {1} = {2}".format(a, b, c) def divide (a, b): c = a / b print "The answer is {0} / {1...
true
1b26680c89752d77a1f78e231a9165c4a25a004c
Ashok-Mishra/python-samples
/python exercises/dek_program054.py
864
4.4375
4
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # Define a class named Shape and its subclass Square. The Square class has # an init function which takes a length as argument. Both classes have a # area function which can print the area of the shape where Shape's area # is 0 by default...
true
40746a8b06658c8d7935e4238f69e17e1d7d9315
Ashok-Mishra/python-samples
/python exercises/dek_program068.py
970
4.40625
4
#!/usr/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # program068: # Please write a program using generator to print the even numbers between # 0 and n in comma separated form while n is input by console. # Example: # If the following n is given as input to the program: # 10 # The...
true
e260d508fca7871b4955a4d44eded3503d532c18
Ashok-Mishra/python-samples
/python exercises/dek_program062.py
482
4.40625
4
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # Write a program to read an ASCII string and to convert it to a unicode # string encoded by utf - 8. # Hints: # Use unicode() function to convert. def do(sentence): # print ord('as') unicodeString = unicode(sentence, "...
true
047481cff2b6856af271cecf82fbeb71e1e68ad3
Ashok-Mishra/python-samples
/python exercises/dek_program071.py
571
4.40625
4
#!/usr/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # program071: # Please write a program which accepts basic mathematic expression from # console and print the evaluation result. # Example: # If the following string is given as input to the program: # 35+3 # Then, the output of...
true
d502383264e8d290050e3b1384916f7888c07677
Ashok-Mishra/python-samples
/python exercises/dek_program045.py
694
4.375
4
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # Write a program which can filter even numbers in a list by using filter # function. The list is: # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. # Hints: # Use filter() to filter some elements in a list. # Use lambda to define anonymous functio...
true
714da2929f26a6b2788bad27279aec26de30f66b
Ashok-Mishra/python-samples
/python exercises/dek_program053.py
747
4.28125
4
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # Define a class named Rectangle which can be constructed by a length and # width. The Rectangle class has a method which can compute the area. # Hints: # Use def methodName(self) to define a method. class Ractangle(object): def _...
true
ef2f0b6305acf196994ca53109035688722d342e
Ashok-Mishra/python-samples
/python exercises/dek_program001.py
913
4.125
4
#!/user/bin/python # -*- coding: utf-8 -*- # Author : (DEK) Devendra Kavthekar # program001 : divisibleBy7not5 # Write a program which will find all such numbers which are divisible by 7 # but are not a multiple of 5, between 2000 and 3200 (both included). # The numbers obtained should be printed in a comma-separate...
true
ae0fed29cb1b49c8deb8c0807df7f222c6aae61a
Ashok-Mishra/python-samples
/python exercises/dek_program008.py
722
4.28125
4
#!/user/bin/python # -*- coding: utf-8 -*- # Author : (DEK) Devendra Kavthekar # program008 : # Write a program that accepts a comma separated # sequence of words as input and prints the words # in a comma-separated sequence after sorting them alphabetically. # Suppose the following input is supplied to the program:...
true
046bd214c938e63595f3d9fdeed82ecf1327b6b7
ayushtiwari7112001/Rolling-_dice
/Dice_Roll_Simulator.py
640
4.4375
4
#importing modual import random #range of the values of dice min_val = 1 max_val = 6 #to loop the rolling through user input roll_again = "yes" #loop while roll_again == "yes" or roll_again == "y": print("Roll the dices...") print("** The values are **") #generating and printing 1st random intege...
true
93278240e775bbba67da1572331d7a1d3cb279db
YeomeoR/codewars-python
/sum_of_cubes.py
656
4.25
4
# Write a function that takes a positive integer n, sums all the cubed values from 1 to n, and returns that sum. # Assume that the input n will always be a positive integer. # Examples: # sum_cubes(2) # > 9 # # sum of the cubes of 1 and 2 is 1 + 8 ### from cs50 video python, lecture 2 # def sum_cubes(n): # cubed...
true
4f481dd9a6205e9979b2f9f17103dd3816a226ab
YeomeoR/codewars-python
/count_by_step.py
827
4.21875
4
# Implement a function named generateRange(min, max, step), which takes three arguments and generates a range of integers from min to max, with the step. The first integer is the minimum value, the second is the maximum of the range and the third is the step. (min < max) # def generate_range(min, max, step): # lis...
true
3d40b4229c78f200c882547349bf5ad433a87908
goruma/CTI110
/P2HW1_PoundsKilograms_AdrianGorum.py
586
4.40625
4
# Program converts pounds value to kilograms for users. # 2-12-2019 # CTI-110 P2HW1 - Pounds to Kilograms Converter # Adrian Gorum # #Pseudocode #input pound amount > calculate pound amount divided by 2.2046 > display #conversion in kilograms #Get user input for pound amount. poundAmount = float(input('En...
true
1ef83617a069d51eb924275376f133f4c323d375
goruma/CTI110
/P4HW4_Gorum.py
796
4.3125
4
# This programs draws a polygonal shape using nested for loops # 3-18-19 # P4HW4 - Nested Loops # Adrian Gorum # def main(): #Enable turtle graphics import turtle #Set screen variable window = turtle.Screen() #Set screen color window.bgcolor("red") #Pen Settings myPen = ...
true
f3de93f96f4247c3bccba5f699eadd168e4439d0
vincent1879/Python
/MITCourse/ps1_Finance/PS1-1.py
844
4.125
4
#PS1-1.py balance = float(raw_input("Enter Balance:")) AnnualInterest = float(raw_input("Enter annual interest rate as decimal:")) MinMonthPayRate = float(raw_input("Enter minimum monthly payment rate as decimal:")) MonthInterest = float(AnnualInterest / 12.0) TotalPaid = 0 for month in range(1,13): print "Month",...
true
b272382f80edeabc91c1a33ba847e34ebff32ac0
Holly-E/Matplotlib_Practice
/Dealing_with_files.py
1,051
4.125
4
# -*- coding: utf-8 -*- """ Spyder Editor Master Data Visualization with Python Course """ #open pre-existing file or create and open new file to write to # you can only write strings to txt files- must cast #'s to str( ) file = open('MyFile.txt', 'w') file.write('Hello') file.close() # can reuse file variable nam...
true
39818a02bdab25b77dbfbc76cba087baecbd55d8
nibbletobits/nibbletobits
/python/day 6 in class.py
624
4.21875
4
# ******************************************** # Program Name: Day 5, in class # Programmer: Jordan P. Nolin # CSC-119: Summer 2021 # Date: June 21, 2021 # Purpose: A program to add the sum of all square roots # Modules used: # Input Variables: number() ect # Output: print statements, that output variable answe...
true
dd9873e3979fc3621a89d469d273f830371d757a
kingamal/OddOrEven
/main.py
500
4.1875
4
print('What number are you thinking?') number = int(input()) while number: if number >=1 and number <= 1000: if number % 2 != 0: print("That's an odd number! Have another?") number = int(input()) elif number % 2 == 0: print("That's an even number! Have another?") ...
true
d6a5f32aea3864aea415514dad886b81d434a8cc
sahilbnsll/Python
/Inheritence/Program01.py
949
4.25
4
# Basics of Inheritance class Employee: company= "Google Inc." def showDetails(self): print("This is a employee") class Programmer(Employee): language="Python" company= "Youtube" def getLanguage(self): print(f"The Language is {self.language}") def showDetails(self): ...
true
6e0f7759356bbfbf474fc5af93eb902e8a875661
sahilbnsll/Python
/Projects/Basic_Number_Game.py
406
4.15625
4
# Basic Number Game while(True): print("Press 'q' to quit.") num =input("Enter a Number: ") if num == 'q': break try: print("Trying...") num = int(num) if num >= 6: print("Your Entered Number is Greater than or equal to 6\n") except Exception as e: ...
true
09a14e49b6bb2b7944bc5ec177586a40761ca6f7
kashifusmani/interview_prep
/fahecom/interview.py
2,489
4.125
4
""" Write Python code to find 3 words that occur together most often? Given input: There is the variable input that contains words separated by a space. The task is to find out the three words that occur together most often (order does not matter) input = "cats milk jump bill jump milk cats dog cats jump milk" """ fro...
true
b1da56330aaed2070bd2a2cf71e7905f800f11db
LaytonAvery/DigitalCraftsWeek1
/Day4/todolist.py
1,089
4.21875
4
choice = "" task = {} def add_task(choice): task = [{"title": name, "priority": priority}] task.append("") for key, value in task.append(""): print(key, value) # print(task) def delete_task(choice): del task def view_all(): for key, value in task.items(): print(key, value)...
true
00aec8932d5749f9f5af478ebb9dbeff183a5c11
krizo/checkio
/quests/singleton.py
874
4.125
4
''' https://py.checkio.org/en/mission/capital-city/ You are an active traveler who have visited a lot of countries. The main city in the every country is its capital and each country can have only one capital city. So your task is to create the class Capital which has some special properties: the first created instance...
true
2c4041af39e9c050adb9f1aa6352a6b9c25c8436
SwethaGullapalli/PythonTasks
/PrintFileNameHavingPy.py
866
4.375
4
#program to print the file extension having py """give input as list of file names iterate each file name in file names list declare one variable for holding file extension declare variables for index and dot index iterate each character in the file name increment the index by 1 if Character is equal to "." ass...
true
012065e8a85e1ac86c2e563e5df3d7feab87101a
Exodus76/aoc19
/day1.py
759
4.125
4
#day 1 part 1 #find the fuel required for a module, take its mass, divide by three, round down, and subtract 2 #part1 function def fuel_required(mass): if(mass < 0): return 0 else: return (mass/3 - 2) #part2 fucntion def total_fuel(mass): total = 0 while(fuel_required(mass) >= 0): ...
true
9eb137a3f310eeb8c6d006bfd72fce5e035e06b2
mansiagnihotrii/Data-Structures-in-python
/Linked List/4_linkedlist_partition.py
851
4.125
4
''' Given a linked list and an element , say 'x'. Divide the same list so that the left part of the list has all the elements less that 'x' and right part has all elements greater than or equal to 'x'. ''' #!/usr/bin/env python3 import linkedlist from linkedlist import LinkedList,Node def partition_list...
true
c696a2980ffe52412000a0f0deda444cea00badf
kcc3/hackerrank-solutions
/problem_solving/python/algorithms/strings/funny_string.py
1,059
4.34375
4
def funny_string(s): """Hackerrank Problem: https://www.hackerrank.com/challenges/funny-string/problem In this challenge, you will determine whether a string is funny or not. To determine whether a string is funny, create a copy of the string in reverse e.g. abc -> cba. Iterating through each string, compa...
true
0562ecb6074ee2c8d62d863db65a1c5a5325fd66
kcc3/hackerrank-solutions
/problem_solving/python/algorithms/strings/mars_exploration.py
919
4.34375
4
def mars_exploration(s): """Hackerrank Problem: https://www.hackerrank.com/challenges/mars-exploration/problem Sami's spaceship crashed on Mars! She sends a series of SOS messages to Earth for help. Letters in some of the SOS messages are altered by cosmic radiation during transmission. Given the signal r...
true
ff2f6d4c31e79e2249438839b9e85049e4f2c4e0
kcc3/hackerrank-solutions
/python/python_functionals/validating_email_addresses_with_filter.py
1,146
4.15625
4
"""Hackerrank Problem: https://www.hackerrank.com/challenges/validate-list-of-email-address-with-filter/problem""" def fun(s): """Determine if the passed in email address is valid based on the following rules: It must have the username@websitename.extension format type. The username can only contain lett...
true
10a395af6ac6efa71d38074c2d88adff4665435e
kcc3/hackerrank-solutions
/problem_solving/python/algorithms/bit_manipulation/maximizing_xor.py
932
4.3125
4
def maximizing_xor(l, r): """Hackerrank Problem: https://www.hackerrank.com/challenges/maximizing-xor/problem Given two integers, l and r, find the maximal value of a xor b, written a @ b, where a and b satisfy the following condition: l <= a <= b <= r Solve: We XOR the l and r bound and ...
true
6d15fcd0279049189d9a54c882f0b27a46034a59
kcc3/hackerrank-solutions
/problem_solving/python/algorithms/implementation/the_grid_search.py
2,824
4.21875
4
def grid_search(g, p): """Hackerrank Problem: https://www.hackerrank.com/challenges/the-grid-search/problem Given a 2D array of digits or grid, try to find the occurrence of a given 2D pattern of digits. For example: Grid ---------- 1234567890 0987654321 1111111111 1111111111 22222...
true
6eba8809d2c6d10aadc221ea78cf0d08d458d967
kcc3/hackerrank-solutions
/data_structures/python/stacks/maximum_element.py
1,176
4.34375
4
"""Hackerrank Problem: https://www.hackerrank.com/challenges/maximum-element/problem You have an empty sequence, and you will be given queries. Each query is one of these three types: 1 x -Push the element x into the stack. 2 -Delete the element present at the top of the stack. 3 -Print the maximum element in...
true
54e29a17af6dfcb36c102bba527a588a533d29f3
kcc3/hackerrank-solutions
/python/built_ins/any_or_all.py
548
4.15625
4
""" Hackerrank Problem: https://www.hackerrank.com/challenges/any-or-all/problem Given a space separated list of integers, check to see if all the integers are positive, and if so, check if any integer is a palindromic integer. """ n = int(input()) ints = list(input().split(" ")) # Check to see if all integers in the ...
true
048f4a1843a7cb34f846a62ff3cc70225a74c763
kcc3/hackerrank-solutions
/data_structures/python/stacks/balanced_brackets.py
2,594
4.40625
4
def is_balanced(s): """Hackerrank Problem: https://www.hackerrank.com/challenges/balanced-brackets/problem A bracket is considered to be any one of the following characters: (, ), {, }, [, or ]. Two brackets are considered to be a matched pair if the an opening bracket (i.e., (, [, or {) occurs to the lef...
true
93d2c4f2eb3485d73051a93cfa531070aa46a563
kcc3/hackerrank-solutions
/problem_solving/python/algorithms/implementation/bigger_is_greater.py
1,021
4.28125
4
def bigger_is_greater(w): """Hackerrank Problem: https://www.hackerrank.com/challenges/bigger-is-greater/problem Given a word, create a new word by swapping some or all of its characters. This new word must meet two criteria: - It must be greater than the original word - It must be the smallest word t...
true
49f4e08c38d8f2429e77d4af1d29e4010c381208
archeranimesh/pythonFundamentals
/code/pyworkshop/02_list/list_sort.py
556
4.21875
4
# Two ways to sort a list. lottery_numbers = [1, 3, 345, 123, 789, 12341] # 1st method does not modify the original list, # returns a shallow copy of original list. print("sorted list: ", sorted(lottery_numbers)) # reverse the list. print("reverse list: ", sorted(lottery_numbers, reverse=True)) x = sorted(lottery_...
true
63a6c50f451fd165eeff0b514a9c5e87b44b531d
michalecki/codewars
/sum_of_intervals.py
1,528
4.1875
4
''' Write a function called sumIntervals/sum_intervals() that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only be counted once. Intervals are represented by a pair of integers in the form of an array. The first value of the interval will always be less t...
true
aa970b317af5316d42807008efbc5b41e8347486
michalecki/codewars
/sum_of_numbers.py
582
4.34375
4
def get_sum(a,b): ''' Given two integers a and b, which can be positive or negative, find the sum of all the numbers between including them too and return it. If the two numbers are equal return a or b. Note: a and b are not ordered! :param a: int :param b: int :return: int ''' i...
true
a72af4074104f47c32f8714796c4a1f6948bc8d1
ShreyanGoswami/coding-contests
/Leetcode weekly contest 189/rearrange_words_in_sentence.py
860
4.25
4
''' Given a sentence text (A sentence is a string of space-separated words) in the following format: First letter is in upper case. Each word in text are separated by a single space. Your task is to rearrange the words in text such that all words are rearranged in an increasing order of their lengths. If two words hav...
true
985bb44337d98dcf1b07803b84ae7417f48c0015
pragatij17/General-Coding
/Day 6/python/sum_of_numbers.py
256
4.25
4
# Write a program that asks the user for a number n and prints the sum of the numbers 1 to n. def sum_of_number(n): sum = 0 for i in range(1,n+1): sum =sum + i return sum n = int(input('Last digit of sum:')) print(sum_of_number(n))
true
dcf7913f53b7ea31ba263c2a26ecd5a52334846e
SaidRem/algorithms
/find_biggest_(recursion).py
404
4.21875
4
# Finds the biggest element using recursion def the_biggest(arr): # Base case if length of array equals 2 . if len(arr) == 2: return arr[0] if arr[0] > arr[1] else arr[1] # Recursion case. sub_max = the_biggest(arr[1:]) return arr[0] if arr[0] > sub_max else sub_max if __name__ == '__mai...
true
6af4513c000f0bf8ae449e915e146515187fed08
PdxCodeGuild/class_mudpuppy
/Assignments/Terrance/Python/lab07-rock_paper_scissors.py
1,327
4.25
4
#lab07-rockpaperscissors.py import random user_input = 'yes' while user_input == 'yes': print('Let\'s play rock-paper-scissors!') print('The computer will ask the user for their choice of rock, paper or scissors, and then the computer will randomly make a selection.') #computer tell user how the game wil...
true
4885b4212545ee9f635fed82f045478503adc865
PdxCodeGuild/class_mudpuppy
/Reviewed/Brea/python/lab17/lab17_version2_checked.py
1,009
4.125
4
#Lab 17, Version 2 Anagram def split(word): return list(word) # good practice, but generally don't make a function # that calls a single function, especially one that's already well-known like list() def remove_spaces(str): new_str = '' for i in range(len(str)): if(str[i] != ' '): new_...
true
37675d15d25aa51006258ff94564fbc04ff6e685
PdxCodeGuild/class_mudpuppy
/1 Python/class_demos/function-lecture/add-number-words-ultimate-solution.py
986
4.125
4
import operator def get_valid_input(): valid_input = False while not valid_input: num1 = input("Spell out a number with letters: ") if num1 in number_dict: return num1 else: print(f"{num1} is not supported. Try entering a different number: ") def reduce_list_to...
true
096d0dc863ab7739debf8e8000545f4e7f7f3cda
PdxCodeGuild/class_mudpuppy
/Assignments/Devan/1 Python/labs/lab11-simple_calculator.py
1,098
4.21875
4
# Lab 11: Simple Calculator Version 3 def get_operator(op): return operators[op] def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y def eval(fn, n1, n2): return fn(n1, n2) operators = {'+': add, '-': subtrac...
true
50962379cef04f28b24854aeeaccc11e9f673a9b
PdxCodeGuild/class_mudpuppy
/Assignments/Eboni/labs06.py
1,170
4.21875
4
# Lab 6: Password Generator """ Let's generate a password of length `n` using a `while` loop and `random.choice`, this will be a string of random characters. """ import random import string # string._file_ = random.choice('string.ascii_letters + string.punctuation + string.digits') # #print((string._file_)) # pass_n...
true
2874845c72626487f96500a7aac40ba91891870e
PdxCodeGuild/class_mudpuppy
/1 Python/solutions/lab09-v2.5.py
617
4.34375
4
# Supported unit types supported_units = ["ft", "mi", "m", "km"] # Ask the user for the unit they want unit = input("What unit do you want: ") # If an invalid unit is specified, alert the user and exit if unit not in supported_units: print("Please enter a valid unit! Options are ft, mi, m, km...") exit() # Get t...
true
7d22fbd58d09e95c2ab94e8adb567da9c3932b36
PdxCodeGuild/class_mudpuppy
/Assignments/Eboni/lab18.py
439
4.125
4
import string input_string = [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 7, 8, 9] #change variable name #create an empty list for index in range(1,len(input_string)-1): left_side = input_string[index-1] middle = input_string[index] right_side = input_string[index + 1] if left_side < middle an...
true
91c7e627278fe3386b9db69c2bf8636072abbeaf
PdxCodeGuild/class_mudpuppy
/Assignments/Eboni/lab09-unit_converter.py
1,154
4.46875
4
""" Ask the user for the number of feet, and print out the equivalent distance in meters. Hint: 1 ft is 0.3048 m. So we can get the output in meters by multiplying the input distance by 0.3048. Below is some sample input/output. """ # import decimal # print("Enter number of feet ") # number_feet = float(input('')) # me...
true
c5d508427ca54175b9b640d81d451807aa07ac21
PdxCodeGuild/class_mudpuppy
/Assignments/Racheal/python/test.py
1,247
4.34375
4
import random #Twinkle, twinkle, little star, #How I wonder what you are! #Up above the world so high, #Like a diamond in the sky. # little = input("Enter adjective:") # wonder = input("Enter verb:") # world = input("Enter noun:") # high = input("Enter adjective:") # diamond = input("Enter noun:") # sky =input("Ent...
true
a8dd0814e6f3294f7c65ed85b0c49311589f6fb8
PdxCodeGuild/class_mudpuppy
/Assignments/Terrance/Python/lab25-atm.py
2,171
4.15625
4
#lab25-atm.py class ATM: def __init__(self, balance=0, interest_rate=.01): self.balance = balance self.interest_rate = interest_rate self.transactions = [] def check_balance(self): '''returns the account balance''' print(f"Your balance is {self.balance}") ...
true
a35cffa0ab2b6c4424709cf8693ef70106688eb9
PdxCodeGuild/class_mudpuppy
/Assignments/Brea/Class Examples/Test_042120.py
1,464
4.1875
4
#Test Examples April 21st, 2020 #average numbers lab re-do # nums = [5, 0, 8, 3, 4, 1, 6] # running_sum = 0 # for num in nums: # running_sum = running_sum + num # print(running_sum) # aver = running_sum / len(nums) # print(f"The average of your numbers is {aver}.") #--------REPL Version of average number...
true
750437c3c078315b3a3ee1981aa1173e2dfaeefe
charlotteviner/project
/land.py
1,632
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 28 17:37:12 2017 @author: charlotteviner Credit: Code written by Andrew Evans. Create elevation data for use in the project. Provided for background on how the artificial environment 'land' was created. Returns: land (list) -- List containi...
true
a13f132c3ac6e87e313570bcc86e470c096ae0b5
koushik-chandra-sarker/PythonLearn
/a_script/o_Built-in Functions.py
1,608
4.125
4
""" Python Built-in Functions: https://docs.python.org/3/library/functions.html or https://www.javatpoint.com/python-built-in-functions """ # abs() # abs() function is used to return the absolute value of a number. i = -12 print("Absolute value of -40 is:", abs(i)) # Output: Absolute val...
true
19c94192bbd45a17858bd0b0348a077042c144b7
gibsonn/MTH420teststudent
/Exceptions_FileIO/exceptions_fileIO.py
2,762
4.25
4
# exceptions_fileIO.py """Python Essentials: Exceptions and File Input/Output. <Name> <Class> <Date> """ from random import choice # Problem 1 def arithmagic(): """ Takes in user input to perform a magic trick and prints the result. Verifies the user's input at each step and raises a ValueError with ...
true
69fe06f4d308eca042f3bf0c30f4a207d65473ac
Yu4n/Algorithms
/CLRS/insertion_sort.py
1,175
4.3125
4
# Loop invariant is that the subarray A[0 to i-1] is always sorted. def insertionSort(arr): # Traverse through 1 to len(arr) for i in range(1, len(arr)): key = arr[i] # Move elements of arr[0..i-1], that are # greater than key, to one position ahead # of their current position ...
true
46fd209659f3dd4ca466d6ca7e7af8f23c661238
mverini94/PythonProjects
/DesignWithFunctions.py
2,401
4.65625
5
''' Author....: Matt Verini Assignment: HW05 Date......: 3/23/2020 Program...: Notes from Chapter 6 on Design With Functions ''' ''' Objectives for this Chapter 1.) Explain why functions are useful in structuring code in a program 2.) Employ a top-down design design to assign tasks to functions 3.) Define a recursiv...
true
caaceae86ca5f9ac137756c98fccecba86b05c88
mverini94/PythonProjects
/__repr__example.py
540
4.34375
4
import datetime class Car: def __init__(self, color, mileage): self.color = color self.mileage = mileage def __repr__(self): return '__repr__ for Car' def __str__(self): return '__str__ for Car' myCar = Car('red', 37281) print(myCar) '{}'.format(myCar) print(str([myCa...
true
2e0c3573ed6698fa45e56983fb5940dc57daeb94
odai1990/madlib-cli
/madlib_cli/madlib.py
2,673
4.3125
4
import re def print_wecome_mesage(): """ Print wilcome and explane the game and how to play it and waht the result Arguments: No Arguments Returns: No return just printing """ print('\n\n"Welcome To The Game" \n\n In this game you will been asked for enter several adjectives,...
true
07cd0f2a3208e04dd0c34a501b68de19f692c35a
Temesgenswe/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
364
4.3125
4
#!/usr/bin/python3 """Module defines append_write() function""" def append_write(filename="", text=""): """Appends a string to a text file Return: the number of characters written Param: filename: name of text file text: string to append """ with open(filename, 'a', encoding="UTF...
true
86e76c7aa9c052b23b404c05f57420750a5029b7
Temesgenswe/holbertonschool-higher_level_programming
/0x06-python-classes/103-magic_class.py
751
4.4375
4
#!/usr/bin/python3 import math class MagicClass: """Magic class that does the same as given bytecode (Circle)""" def __init__(self, radius=0): """Initialize radius Args: radius: radius of circle Raises: TypeError: If radius is not an int nor a float ""...
true
d3e203ffb4eac1ffe1bd1776de5f06220b81b6c1
LorenzoChavez/CodingBat-Exercises
/Warmup-1/sum_double.py
231
4.15625
4
# Given two int values, return their sum. Unless the two values are the same, then return double their sum. def sum_double(a, b): result = 0 if a == b: result = (a+b) * 2 else: result = a+b return result
true
7ce2d175697104c3df72fd437f9fe01fc0ed5053
alxanderapollo/HackerRank
/WarmUp/salesByMatchHR.py
1,435
4.3125
4
# There is a large pile of socks that must be paired by color. Given an array of integers # representing the color of each sock, determine how many pairs of socks with matching colors there are. # Example # There is one pair of color and one of color . There are three odd socks left, one of each color. # The number...
true
3b38c1507501d451d741da0daa812a4f63152941
kushagra65/Python-CLock-Project
/ANALOG CLOCK.py
2,034
4.28125
4
#import the essential modules import time# importing the time module import turtle #importing the turtle module from the LOGO days #---------------------------------------------------------------- #creating the screen of the clock wn = turtle.Screen()#creating a screen wn.bgcolor("black")#setting the backgroung color ...
true
e783154304256165ff443159d4181209454d2e08
kanishk333gupta/Elementary-Signals-in-continuous-and-discrete-time
/Exponential signal.py
1,765
4.34375
4
#EXPONENTIAL SIGNAL import numpy as np #Importing all definitions from the module and shortening as np import matplotlib.pyplot as mplot #Shortening as mplot ,an alias to call the library name ###CONTINUOUS x = np.linspace(-1, 2, 100) # 100 linearly spaced numbers from -1 to 2 xCT ...
true
26864be554f52e6a3dc2cee5455de74599228579
angellovc/holbertonschool-higher_level_programming
/0x0B-python-input_output/1-number_of_lines.py
355
4.15625
4
#!/usr/bin/python3 """ number_of_lines function module """ def number_of_lines(filename=""): """Get the numbers of lines into a text file Keyword Arguments: filename {str} -- [text file] """ with open(filename, mode="r", encoding="UTF8") as f: lines = 0 for line in f: ...
true
687e728de6afc1a57f322db9204a20957055b25c
angellovc/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/2-matrix_divided.py
1,770
4.125
4
#!/usr/bin/python3 """ Matrix_divided functions module """ def matrix_divided(matrix, div): """ Make a division of all the elements into the matrix by a div number returns a new result list Args: matrix: matrix of dividends, just floats or integers are allowed div: that's represent the...
true
f0c1ca32d74b47203d48ebe82b5520069a1bdacc
angellovc/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-read_lines.py
515
4.21875
4
#!/usr/bin/python3 """ read_lines module """ def read_lines(filename="", nb_lines=0): """read and print n number of lines into a text file Keyword Arguments: filename {str} -- [text file] (default: {""}) nb_lines {int} -- [n lines to read] (default: {0}) """ with open(filename, mode="r...
true
13ecec23ce620311c11f33da1ba3bba90cbd7fec
angellovc/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/100-print_tebahpla.py
241
4.4375
4
#!/usr/bin/python3 """ print the ascii alphabet in reverse using upper and lower characters""" for lower, upper in zip(range(122, 96, -2), range(89, 64, -2)): print("{}{}".format(chr(lower), chr(upper)), end='') # print ascii numbers
true
70a97b65e8cb2c963b0ae981b52ae5b191743d57
emmaAU/CSC280
/Random.py
575
4.125
4
#import random #print(random.random) import math print(math) a = int(input('enter coefficient for x**2 ')) b = int(input('enter b: ')) c = int(input('what is c?: ')) disc = b**2 - 4*a*c if disc > 0: root1 = -b + math.sqrt(disc) / 2*2 print(root1) root2 = -b - math.sqrt(disc) / 2*2 print(root2) elif d...
true
57eb63f9f063deda592db8a58ebf420737f5f37c
etridenour/digitalCrafts
/classNotes/python/class7-2.py
2,516
4.3125
4
# class MyClass: # def SayHello(): # print("Hello there!") # MyClass.SayHello() class Person: def greet (self): #self points to object you are creating (ex. me, matt) print("Hello") me = Person() me.greet() matt = Person() matt.greet() # class MyClass: # Greeting = " " # lcass variable, ...
true
4f7ff64e0ec87b80e8689e8d484f9c0cefd3fbdf
ParkerCS/ch18-19-exceptions-and-recursions-aotoole55
/recursion_lab.py
1,152
4.78125
5
''' Using the turtle library, create a fractal pattern. You may use heading/forward/backward or goto and fill commands to draw your fractal. Ideas for your fractal pattern might include examples from the chapter. You can find many fractal examples online, but please make your fractal unique. Experiment with the vari...
true
6efd603459989c8fa85b848c52d05a96a2ff8a74
peluza/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/3-say_my_name.py
719
4.5625
5
#!/usr/bin/python3 """3-say_my_name """ def say_my_name(first_name, last_name=""): """say_my_name Arguments: first_name {str} -- the value is the first_name Keyword Arguments: last_name {str} -- the value is the las_name (default: {""}) Raises: TypeError: first_name must...
true
428fd8714cd7c2542af1000822bf90da9dd58847
linleysanders/algorithms
/Homework Week One (Average of Averages)/Linley Sanders Week One Homework.py
2,609
4.28125
4
# coding: utf-8 # # Lede Algorithms -- Assignment 1 # # In this assignment you will use a little algebra to figure out how to take the average of averages. # In[1]: import pandas as pd import matplotlib.pyplot as plt import requests get_ipython().run_line_magic('matplotlib', 'inline') # First, read in the tita...
true
fbb3938b667cba8afe5144c023cacbd833028f03
crashtack/exercism
/python/clock/clock.py
1,144
4.34375
4
class Clock(object): """ A Clock class that ignores date """ def __init__(self, hours=0, minutes=0): """ Initialize the Clock object """ self.hours = hours % 24 self.minutes = minutes self.time_min = (self.hours * 60) + self.minutes self.time_min = self.time_min % 1440 ...
true
deb0106dadea39101d8c40357c3f41f9383a9937
GarryK97/Python
/Hashtable/Task5.py
2,715
4.4375
4
from Task3 import HashTable def read_file_removesp(file_name): """ Read a text file and convert it to a list of words without any special characters. :param file_name: File to read :return: the list of words """ f = open(file_name, 'rt', encoding='UTF8') file_list = [] for l...
true
606de1aa9e681af56f022880698088b3ea58904d
nidakhawar/PracticePythonExcercises
/AverageOfSubjects.py
510
4.1875
4
biology=float(input("Please input your Biology score:")) chemistry=float(input("Please input your Chemistry score:")) physics=float(input("Please input your Physics score:")) if biology<40: print("Fail") if chemistry<40: print("Fail") if physics<40: print("Fail") else: score=((biology+chemistry+physics)/3) ...
true
976cc8ab3327128b679d3d205e8c2dc1b2daae0b
zacharykaczor/Small-Programs
/odd_numbers.py
535
4.1875
4
# Based on https://www.youtube.com/watch?v=LkIK8f4yvOU. # The Difference of Two Squares. number = int(input("Please enter a positive odd number: ")) while number % 2 == 0 or number < 0: number = int(input( "Please enter a positive number: " if number < 0 else "Please enter an odd number: " ))...
true
bce8bf614aca3883f2ac618caa8f00bc32a5dd73
costacoz/python_design_patterns
/behavioral/iterator.py
1,296
4.5
4
# Iterators are built into Python. # It can be engaged, using 'iter(arg*)' function # arg* - can be list, tuple, dic, set and string. # Below is the example of using it. # fruits_tuple = {'apple', 'blueberry', 'cherry', 'pineapple'} # fruits_tuple = ('apple', 'blueberry', 'cherry', 'pineapple') # fruits_tuple = ['appl...
true
db6a67f488a152ccc2768d3d24728afb318f10de
CodecoolBP20172/pbwp-3rd-si-code-comprehension-kristofilles
/comprehension.py
2,101
4.3125
4
"""Its a bot what randomly choose a number between 1 and 20, and the user need to guess within 6 round what number was choosen by the bot.""" import random #import the random module guessesTaken = 0 #assign 0 to guessesTaken variable print('Hello! What is your name?') #print out this sentence myName = input() #assig...
true
07bd3a329eafee4c2398a08943aeb985a282b6f2
onionmccabbage/pythonTrainingMar2021
/using_ternary.py
474
4.40625
4
# Python has one ternary operator # i.e. an operator that takes THREE parts # all other operators are binary, i.e. they take TWO parts # e.g. a = 1 or 3+2 # the ternary operator works like this # 'value if true' 'logical condition' 'value if false' x = 6 y = 5 print("x" if x>y else "y") # alternative syn...
true
375b0579cdbe45e4a66d954f8d5e767f8ef70546
justEhmadSaeed/ai-course-tasks
/Python Assignment 1/Part 2/Task 5.py
261
4.28125
4
# Write a list comprehension which, from a list, generates a lowercased version of each string # that has length greater than five strings = ['Some string', 'Art', 'Music', 'Artifical Intelligence'] for x in strings: if len(x) > 5: print(x.lower())
true
f21b75948484cc34cea7d9d166dc47e72611749d
liadbiz/Leetcode-Solutions
/src/python/degree_of_array.py
1,373
4.15625
4
""" Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums. Example 1: Input: [1, 2, 2, 3, 1] Output: 2 Explan...
true
bbeb124cd35e865c17ae7a9691022031b81ba553
jonahtjandra/sudoku-solver
/Sudoku.py
2,939
4.15625
4
class Sudoku: def __init__(self, board:'list[list]') -> None: if (len(board) != 9 or len(board[0]) != 9): raise "Expected a 9 by 9 board" self.board = board self.iterations = [] # for printing out the 2d list representation of the board def display(self, board:'list[list]'): ...
true
53da6c914c6b7139abf47e3b214b47725e93c50b
comalvirdi/CPE101
/LAB4/loops/cubesTable.py
1,518
4.3125
4
# CPE 101 Lab 4 # Name: def main(): table_size = get_table_size() while table_size != 0: first = get_first() increment = get_increment() show_table(table_size, first, increment) table_size = get_table_size() # Obtain a valid table size from the user def get_table_size(): size = int(i...
true
e9cb86ab9b68ed4b6f0c061f48629cb0eb270316
lguychard/loispy
/src/loispy/interpreter/procedure.py
2,279
4.28125
4
from environment import Environment class Procedure(object): """ Represents a loisp procedure. A procedure encapsulates a body (sequence of instructions) and a list of arguments. A procedure may be called: the body of the procedure is evaluated in the context of an environment, and given """ ...
true
2fa3fbd312b86064da4f77d85dd226575de9dcaf
Heisenberg27074/Web-Scraping-with-Python3
/lists/maxmin.py
724
4.3125
4
#Rewrite the program that prompts the user for a list of #numbers and prints out the maximum and minimum of the numbers at #the end when the user enters “done”. Write the program to store the #numbers the user enters in a list and use the max() and min() functions to #compute the maximum and minimum numbers after t...
true
75a6883fb38db72e5775e46f6e94e49a3c4a9978
dimitardanailov/google-python-class
/python-dict-file.py
1,842
4.53125
5
# https://developers.google.com/edu/python/dict-files#dict-hash-table ## Can build up a dict by starting with the empty dict {} ## and storing key / value pairs into the dict like this: ## dict[key] = value-for-that-key dict = {} dict['a'] = 'alpha' dict['g'] = 'gamma' dict['o'] = 'omega' print dict ## {'a': ...
true
c7668e86b91ed2fbcaa51d0d4811ae448d0f2a14
RobDBennett/DS-Unit-3-Sprint-1-Software-Engineering
/module4-software-testing-documentation-and-licensing/arithmetic.py
1,941
4.21875
4
#!/usr/bin/env python # Create a class SimpleOperations which takes two arguements: # 1. 'a' (an integer) # 2. 'b' (an integer) # Create methods for (a, b) which will: # 1. Add # 2. Subtract # 3. Multiply # 4. Divide # Create a child class Complex which will inherit from SimpleOperations # and take (a, b) as argueme...
true
8a60d618f47ce9917bf2c8021b2863585af07672
sreesindhu-sabbineni/python-hackerrank
/TextWrap.py
511
4.21875
4
#You are given a string s and width w. #Your task is to wrap the string into a paragraph of width w. import textwrap def wrap(string, max_width): splittedstring = [string[i:i+max_width] for i in range(0,len(string),max_width)] returnstring = "" for st in splittedstring: returnstring += s...
true
25001af33ac7a663e5f20810c42d5cba3ac73242
AhmedElkhodary/Python-3-Programming-specialization
/1- Python Basics/FinalCourseAssignment/pro5.py
620
4.15625
4
#Provided is a list of data about a store’s inventory where each item #in the list represents the name of an item, how much is in stock, #and how much it costs. Print out each item in the list with the same #formatting, using the .format method (not string concatenation). #For example, the first print statment shou...
true
a53c2faa1c8da8d9f736720d2f653811898ea67a
AhmedElkhodary/Python-3-Programming-specialization
/1- Python Basics/Week4/pro3.py
256
4.3125
4
# For each character in the string already saved in # the variable str1, add each character to a list called chars. str1 = "I love python" # HINT: what's the accumulator? That should go here. chars = [] for ch in str1: chars.append(ch) print(chars)
true
a1b182cd04c27dc9c000923a627c7e6cb2a2ff3b
DiegoCol93/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/square.py
2,275
4.25
4
#!/usr/bin/python3 """ Module for storing the Square class. """ from models.rectangle import Rectangle from collections import OrderedDict class Square(Rectangle): """ Por Esta no poner esta documentacion me cague el cuadrado :C """ # __init__ | Private | method |-------------------------------------------| ...
true
971187848e721a42aec82fb6aa5d13f881d84ff4
johnmwalters/dsp
/python/q8_parsing.py
1,242
4.40625
4
# The football.csv file contains the results from the English Premier League. # The colums labeled 'Goals and 'Goals Allowed' contain the total number of # goals scored for and against each team in that season (so Arsenal scored 79 goals # against opponents, and had 36 goals scored against them). Write a program to rea...
true
499b850f68b05aceb843bcd4f6f94c9cb1077afc
thales-mro/python-cookbook
/2-strings/4-pattern-match-and-search.py
1,181
4.125
4
import re def date_match(date): if re.match(r'\d+/\d+/\d+', date): print('yes') else: print('no') def main(): text = 'yeah, but no, but yeah, but no, but yeah' print(text.find('no')) date1 = '02/01/2020' date2 = '02 Jan, 2020' date_match(date1) date_match(date2) ...
true
881166784fd6a82253a5b189f956582a7a8de5e0
firebirdrazer/CodingTests
/check_paren.py
1,952
4.40625
4
def check_bracket(Str): stack = [] #make a empty check stack while Str != "": #as long as the input is not empty tChar = Str[0] #extract the first character as the test character ...
true