blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
d974cd6b8c7f5e8ea7672f0e935acac30dbd82a9
mleue/project_euler
/problem_0052/python/e0052.py
840
4.15625
4
def get_digits_set(number): """get set of char digits of number""" return set((d for d in str(number))) def is_2x_to_6x_permutable(number): """check if all numbers 2x, 3x, 4x, 5x, 6x contain the same digits as number""" digits_set = get_digits_set(number) multipliers = (2, 3, 4, 5, 6) for m in multipliers:...
true
4ff167bec52d0c1ab4196536b6ec81be4f3d13fe
gunit84/Code_Basics
/Code Basics Beginner/ex20_class_inheritance.py
1,288
4.34375
4
#!python3 """Python Class Inheritance... """ __author__ = "Gavin Jones" class Vehicle: def general_usage(selfs): print("General use: transportation") class Car(Vehicle): def __init__(self): print("I'm Car ") self.wheels = 4 self.has_roof = True def specific_usage(self)...
true
d10ced02db8f0c93bd026b745cf916c1519fe4ef
gunit84/Code_Basics
/Code Basics Beginner/ex21_class_multiple_inheritance.py
572
4.46875
4
#!python3 """Python Multiple Inheritance Example... """ __author__ = "Gavin Jones" class Father(): def skills(self): print('gardening, programming') class Mother(): def skills(self): print("cooking, art") # Inherits from 2 SuperClasses above class Child(Father, Mother): def skills(se...
true
5b3ae06bb5ab6d7fbedf32e70113462324728453
lilsweetcaligula/sandbox-online-judges
/leetcode/easy/number_of_segments_in_a_string/py/solution.py
528
4.125
4
# # In order to count the number of segments in a string, defined as # a contiguous sequence of non-space characters, we can use the # str.split function: # https://docs.python.org/3/library/stdtypes.html#str.split # # Given no parameters, the string is split on consecutive runs of # whitespace and produce a list of...
true
80e5adbdcb0cf56f35ea9676103e5dad73771473
lilsweetcaligula/sandbox-online-judges
/leetcode/easy/move_zeroes/py/solution.py
1,633
4.125
4
# # We use a slow/fast pointer technique. The fast pointer (index) is running ahead, # reporting whether the value it is pointing to is a zero value or not. # # If nums[fast] is not a zero value, we copy the value to nums[slow] and increment # the slow pointer. This way, by the time the fast pointer reaches the end of...
true
f93a0e365415b56b37ddc49187da509706235061
Tanmay-Thanvi/DSA-and-Leetcode-Walkthroughs
/Trees/Root_to_leaf_paths_binary_tree.py
1,489
4.40625
4
#1. Idea here is we want to return a list of strings which contains all of the root to leaf paths in the binary tree. #2. So initialize a list (path_list) then we are going to make a recursive call function. In the function we will pass the root of the binary tree and a empty string which we will modify and add node v...
true
4c4b94ca6467f49e4d8309393d0b64723a85c59c
Tanmay-Thanvi/DSA-and-Leetcode-Walkthroughs
/Trees/Max_path_sum_in_binary_tree.py
2,107
4.4375
4
#1. Firstly, understand what the question wants. It wants the MAX PATH. Recall a path is a sequence or iteration of nodes in a binary tree where there are no cycles. #2. Now, I want you to approach the recursion this way - "What work do I want to do at EACH node?" Well at each node we want to find the value of its lef...
true
12cbb9b004d8360c72ca0e797b88094b86037cdb
ctec121-spring19/programming-assignment-2-beginnings-JLMarkus
/Prob-3/Prob-3.py
1,055
4.5
4
# Module 2 # Programming Assignment 2 # Prob-3.py # Jason Markus def example(): print("\nExample Output") # print a blank line print() # create three variables and assign three values in a single statement v1, v2, v3 = 21, 12.34, "hello" # print the variables print("v1:", v1) ...
true
db0479a9cb64020a74d3226af0b38ebbda140e66
joyonto51/Programming_Practice
/Python/Old/Python Advance/Practise/Factorial_by_Recursion.py
347
4.21875
4
def factorial(number): if number == 0: return 1 else: sum = number * factorial(number - 1) return sum number=int(input("please input your number:")) ''' num=number-1 num1= number for i in range(num,0,-1): sum=num1*i print(num1,"*",i,"=",sum) num1=sum ''' ...
true
90d6f45188cd37274453b2b944ad5432de3a60d5
sunshine55/python-practice
/lab-01/solution_exercise1.py
2,140
4.1875
4
def quit(): print 'Thank you for choosing Python as your developing tool!' exit() def choose(choices=[]): while True: choice = raw_input('Please choose: ') if len(choices)==0: return choice elif choice in choices: return choice else: print 'You must choose from one of the following: ', sorted(choic...
true
671443c555f412d1c03018de29760dbf5bb67f82
nicap84/mini-games
/Guess the number/Guess the number.py
2,218
4.125
4
# template for "Guess the number" mini-project # input will come from buttons and an input field # all output for the game will be printed in the console #import simplegui try: import simplegui except ImportError: import SimpleGUICS2Pygame.simpleguics2pygame as simplegui import random # initialize global var...
true
f99b9d736330ed66277e98311ccfb3a07b984f9e
Louis95/oop-in-python
/Exception/OnlyEven.py
595
4.125
4
''' While this class is effective for demonstrating exceptions in action, it isn't very good at its job. It is still possible to get other values into the list using index notation or slice notation. This can all be avoided by overriding other appropriate methods, some of which are double-underscore methods. ''' cl...
true
8a81a67dad68f690099e1e4f435c44a990b96ed4
khadeejaB/Week10D2A2
/questionfile.py
749
4.3125
4
#In this challenge, a farmer is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species: chicken = 2 cow = 4 dog = 4 #The farmer has counted his animals and he gives you a subtotal for each species. You have to implement a script or function that returns the ...
true
359824127dd9b48c34a2df72f7f21fd85077d9ff
Armin-Tourajmehr/Learn-Python
/Number/Fibonacci_sequence.py
950
4.28125
4
# Enter a number and have the program generate # The Fibonacci sequence number or the nth number def Fibonacci_sequence(n): ''' Return Fibonacci :param n using for digit that user want to calculator Fibonacci: :return sequence number as Fibonacci : ''' # Initialization number a = 1 b =...
true
c64ac69d915f54109e959d046f6317348650a460
evan-nowak/other
/generic/date_range.py
2,881
4.53125
5
#!/usr/bin/env python """ ######################### Date Range ######################### :Description: Generates a date range based on starting/ending dates and/or number of days :Usage: Called from other scripts :Notes: The function needs exactly two of the three arguments to work Wh...
true
0a5f2461b362405b244867ba8a8b44c21a363e51
ferdiansahgg/Python-Exercise
/workingwithstring.py
493
4.34375
4
print("Ferdi\nMIlla") print("Ferdi\"MIlla") phrase = "Ferdiansah and MilleniaSaharani" print(phrase.upper().isupper())#checking phrase is uppercase or not, by functioning first to upper and check by function isupper print(len(phrase))#counting the word print(phrase[0])#indexing the character print(phrase.index("F"))#ph...
true
53255ace53f8e0265529c46a5bcacee089a7d404
Patrick-Ali/PythonLearning
/Feet-Meters.py
381
4.15625
4
meterInches = 0.3/12 meterFoot = 0.3 footString = input("enter feet: ") footInt = int(footString) inchString = input("enter inches: ") inchInt = int(inchString) footHeightMeters = meterFoot*footInt inchHeightMeters = meterInches*inchInt heightMeters = round(footHeightMeters + inchHeightMeters, 2) pri...
true
a092e63cdfed3394aae4902d689b13140d1e42b9
sarahsweeney5219/Python-Projects
/dateDetectionRegex.py
1,663
4.75
5
#date detection regex #uses regular expression to detect dates in the DD/MM/YYYY format (numbers must be in min-max range) #then tests to see if it is a valid date (based on number of days in each month) import re, calendar #creating the DD/MM/YYYY regex dateRegex = re.compile('(3[01]|[12][0-9]|0?[1-9])\/(0?[1-9]|1[0...
true
76330f9dfd49d09599509e9909d2ef0715eeb9c3
JeffreybVilla/100DaysOfPython
/Beginner Day 13 Debugging/debugged.py
1,709
4.1875
4
############DEBUGGING##################### # # Describe Problem # def my_function(): # """ # Range function range(a, b) does not include b. # 1. What is the for loop doing? # The for loop is iterating over a range of numbers. # # 2. When is the function meant to print 'You got it'? # If...
true
c0b096fa60b91b859fac13c0bf6a804116140dfc
hlainghpone2003/SFU-Python
/Sets.py
2,214
4.15625
4
#Sets includes a data type for sets. Curly braces or the set() fuction can be used to create sets. basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} print(basket) #show that duplicates have been removed 'orange' in basket # fast member testing 'crabgrass' in basket Demonstrate set operation on unique ...
true
2be5ff41a0dd3029786f149dd7674ead6a9f07f1
titojlmm/python3
/Chapter2_Repetition/2_01_RockPaperScissors.py
1,346
4.25
4
import random # This program plays the game known as Rock-Paper-Scissors. # Programmed by J. Parker Jan-2017 print("Rock-Paper_Scissors is a simple guessing game.") print("The computer will prompt you for your choice, ") print("which must be one of 'rock', 'paper', or 'scissors'") print("When you select a choice the c...
true
8e616784d502fdcb9f874d394e8129137aaec025
yungjas/Python-Practice
/even.py
315
4.28125
4
#Qn: Given a string, display only those characters which are present at an even index number. def print_even_chars(str_input): for i in range(0, len(str_input), 2): print(str_input[i]) text = "pynative" print("Original string is " + text) print("Printing only even index chars") print_even_chars(text)
true
83655407a288aa3d7c0192bc936e40eaaee5e22e
not-so-daily-practice/top-80-interview-algorithms
/strings_and_arrays/reverse_array_except_special.py
554
4.15625
4
def reverse_except_special(arr): """ Given an array, reverse it without changing the positions of special characters :param arr: array to reverse :return: reversed array """ arr = list(arr) left = 0 right = len(arr) - 1 while left < right: if not arr[left].isalpha(): ...
true
1ce26ff860b909d7f61db0e82b957103bc70519b
akshitsarin/python-files
/singlylinkedlistfinal.py
1,587
4.34375
4
# singly linked list final class Node: def __init__(self, data): self.data = data # Assign data self.next = None # Initialize next as null class LinkedList: def __init__(self): self.head = None # initialise head def push(self, new_data): new_node = Node(new_data) ...
true
68863a0fd52ddce4d306749ee22ca4e81cde8ba3
provishalk/Python
/Linked List/LinkedList.py
1,701
4.15625
4
class LinkedList: head = None class Node: def __init__(self, x): self.value = x self.next = None def insert(self,value): toAdd = self.Node(value) if self.head == None: self.head = toAdd return temp = self.head while temp...
true
ba7cb756981686727f4c3c2722b3ac59fbf9d608
yossibaruch/learn_python
/learn_python_the_hard_way/ex3.py
855
4.34375
4
# print some output print "I will now count my chickens:" # order of math print "Hens", 25+30/6 # order of math print "Roosters", 100-25*3%4 # print something print "Now I will count the eggs:" # math order, first multiply/div then add/sub, also what / and % do print 3+2+1-5+4%2-1/4+6 # print something print...
true
ece25778d428f34d312ed89566a52d317d4c3bf5
yossibaruch/learn_python
/non-programmers/13-braces.py
1,447
4.3125
4
import string print(""" # Iterate on characters from string # Find opening braces and "remember" them in order # Find closing braces and make sure it fits the last opening braces # If "yes", forget last opening braces # If "no", return False # If memory of opening braces is not empty - return F...
true
4dbef496f2b1a7f6a40083bb1851101865b2a8f0
Muscularbeaver301/WebdevelopmentSmartNinja201703
/Kursprojekte/Kursprogramm/examples/VehicleManager.py
1,723
4.15625
4
class Vehicle(object): def __init__(self, brand, model, km, service_date): self.brand = brand self.model = model self.km = km self.service_date = service_date def show(self): print "{} {} {} {}".format(self.brand, self.model, self.km, self.service_date) if __name__ == ...
true
bfadef36e211fb74bc5191806e7e20577889683e
JayWebz/PythonExercises
/final/project3 - EmployeeDbCRUDapp/emp.py
1,513
4.25
4
class Employee: """employee is an object that creates and manipulates data about a particular employee such as calculating pay, printing employee info, .""" # Initialize attributes def __init__(self, firstName, lastName, employeeID, status, payRate): self.firstName = firstName self.lastName = lastName self.e...
true
5c8978b9860f2cba173eafa34cc0315bd0fe7a12
JayWebz/PythonExercises
/Module3/project4 - EpactCalc/hw3extraCredit.py
1,264
4.40625
4
#! /usr/bin/python # Exercise No. extra credit # File Name: hw3extraCredit.py # Programmer: Jon Weber # Date: Sept. 10, 2017 # # Problem Statement: Write a user-friendly program that # prompts the user for a 4-digit year and then outputs the value of the Gregorian epact for that year # # Overall Plan...
true
cd446e7ed3da381d0ad861dfebed7769a61ac211
JayWebz/PythonExercises
/Module4/project2 - CalcSumGUI/hw4project2.py
2,298
4.5
4
#! /usr/bin/python # Exercise No. 2 # File Name: hw4project2.py # Programmer: Jon Weber # Date: Sept. 17, 2017 # # Problem Statement: Create a Graphical User Interface # for a program that calculates sum and product of three numbers. # # Overall Plan: # 1. Create a window for objects and print welcome...
true
35621ed7d9d2dfdae93b1fba45b942a3a668efac
JayWebz/PythonExercises
/final/project3 - EmployeeDbCRUDapp/record.py
1,308
4.3125
4
class Employee: """employee is an object that creates and manipulates data about a particular employee such as calculating pay, printing employee info, .""" # Initialize attributes def __init__(self, firstName, lastName, employeeID, status, payRate): self.firstName = firstName self.lastName = lastName self.e...
true
48df7ef8f1638b25aa1c405fa7f941792d5d6029
Slackd/python_learning
/PY4E/05-iterations.py
665
4.28125
4
#! /usr/bin/python3 # Write another program that prompts for a list of # numbers as above and at the end prints out both the maximum # and minimum of the numbers instead of the average. userNums = input("Enter Numbers Separated by spaces: ") inputNums = userNums.split() for i in range(len(inputNums)): inputNum...
true
91a712961cbd6bfd8c8ec3de6629d178d6e0b62e
Slackd/python_learning
/First/if_else.py
616
4.34375
4
is_male = False is_tall = True if is_male and is_tall: print("You are a tall male") elif is_male and not (is_tall): print("you are a short male") elif not (is_male) and is_tall: print("you are not a male, but are tall") else: print("you are neither male not tall or both") num1 = input("Enter 1st N...
true
86d1bd41d5682d09eaa8356a0dcde8c978b11210
Voidivi/Python-1
/Pig Latin Translator.py
1,847
4.40625
4
#!/usr/bin/env python3 # Assignment Week 6 - Pig Latin Translator # Author: Lyssette Williams # global values for the program ay = 'ay' way = 'way' vowels = ['a','e', 'i', 'o', 'u'] punctuations = '''!()-[];:'",<>./?@#$%^&*_~''' # decided to add some formatting stuff to make it more readable def display():...
true
f5b22ec6f30c9d286bc75a37f5001c493abe6b58
Maria-Lasiuta/geegs_girls_lab3
/ex3(3).py
363
4.15625
4
#Calculate number of distinct characters in a string using a for loop. def unique_count(word): k=list() b = word.split() b = ''.join(b) for x in b: if x not in k: k.append(x) return len(k) enter=input() print('унікальних символів:',unique_count(enter)) ...
true
4ae76eeee25d37e786eda9fea0dc14163c77a8fa
epotyom/interview_prepare
/coding/sorts/quicksort.py
1,154
4.28125
4
def sort(data): """ Quicksort function Arguments: data(list): list of numbers to sort """ sortIteration(data, 0, len(data)-1) def sortIteration(data, first, last): """ Iteration of quicksort Arguments: data(list): list to be sorted first(int): first element of iteration last(int): l...
true
820dca361b752699d098b0d9b59615971ecdc524
yohannabittan/iterative_hasher
/iterative_hasher.py
2,778
4.3125
4
#written by Yohann Abittan #this program uses hashlib to either produce hashes which have been hashed iteratively a given number of times #or to test wether a given hash matches a password after a number of iterations of hashing import hashlib def encryptMd5(initial): encrypted = hashlib.md5() encrypt...
true
1817ccf74ed79881b17d5e029cffa926ee282e93
chrismvelez97/GuideToPython
/techniques/exceptions/value_error.py
989
4.625
5
# How to handle the value error ''' The value error is when your program is expecting a certain value type back such as a number or a string and you get the other. For example, we'll be using a calculator that can add, but get a value error if we type letters in place of numbers. The following is ...
true
6dfde392607bfe8accf5baa0e097e7ee838717da
chrismvelez97/GuideToPython
/techniques/files/storingData/saving_user_data.py
730
4.1875
4
# How to save user data ''' Using the json.dump() and json.load() techniques we just learned about, we can actually save user data to be used at a later time. ''' import json username = input("Hello! What is your name?\n\n") path = "/home/chrismvelez/Desktop/GuideToPython3/techniques/files/s...
true
64c2d50ebe0d127df0170b3834507467c89340d0
chrismvelez97/GuideToPython
/data_types/dictionaries.py
1,541
4.90625
5
# How to use dictionaries ''' Dictionaries are special forms of containers that do NOT have indices. They can start off empty and have values added later Instead, they have key and value pairs. To access a value you use the key. The keys must be strings, and the values can hold anything f...
true
f837053b00cd472b1097c4f4e72e4e7b053e0100
chrismvelez97/GuideToPython
/techniques/classes/default_modifying_attributes.py
1,751
4.625
5
# Default values and Modifying attributes class Character(): """ This class will model a character in a videogame to show the different things we can do with classes. """ def __init__(self, name): ''' You can see we have attributes we didn't require in ...
true
080d28c6f1467abf777e76ac49a786b0e0055333
chrismvelez97/GuideToPython
/techniques/functions/built_in_functions/sum.py
478
4.15625
4
# How to use the sum() function ''' The sum() function adds all the numbers up from a list of numbers. Note that for min, max, and sum, you can only do them on lists full of numbers. also it is not a method attached to the number datatype which is why it is in the techniques folder instead o...
true
97a8074488d0ee8e03d0f1ba2e3ed725c0820691
chrismvelez97/GuideToPython
/techniques/functions/built_in_functions/range.py
1,471
4.90625
5
# How to use range in python ''' So after looking over this I really debated with myself if I should put this under method or techniques and I ended up putting it here because, the function doesn't execute if not in conjunction with a for loop, hence it being a technique. The range(start, en...
true
38c5fa3b7f2798b48e0aaab62bf319f18ff2c8f9
chrismvelez97/GuideToPython
/techniques/loops/looping_dictionaries.py
995
4.5
4
# How to loop Dictionaries ''' You can loop through dictionaries but it should be noted that they will not come out in any specific order because are not ordered by indices ''' dictionary = { "words": { "penultimate": "The second to last item in a group.", "ultimate": "The...
true
a5d24fbee492882a3802ab5a147d333a937494b2
pratishhegde/rosalind
/problems/fibd/fibd.py
1,184
4.125
4
# -*- coding: utf-8 -*- ''' Recall the definition of the Fibonacci numbers from “Rabbits and Recurrence Relations”, which followed the recurrence relation Fn=Fn−1+Fn−2 and assumed that each pair of rabbits reaches maturity in one month and produces a single pair of offspring (one male, one female) each subsequent mon...
true
7ac4527ba233e39bf952a56b069e4a2f5ff4418c
Wamique-DS/my_world
/Some Basic Program in Python...py
1,650
4.1875
4
# coding: utf-8 # In[3]: # prgogarm to find Area of circle radius=eval(input("Enter the radius of circle ")) # eval takes any value either integer or float # calculate area area=radius*radius*3.14 # Display result print("Area of circle of radius", radius,"is",round(area,2)) # In[8]: # Program to find area of...
true
901bfe55f38adb6702d4ce85ef8473b0a6e7da4d
kunzhang1110/COMP9021-Principles-of-Programming
/Quiz/Quiz 6/quiz_6.py
2,804
4.1875
4
# Defines two classes, Point() and Triangle(). # An object for the second class is created by passing named arguments, # point_1, point_2 and point_3, to its constructor. # Such an object can be modified by changing one point, two or three points # thanks to the function change_point_or_points(). # At any stage, the ob...
true
c159ab3cb87d420b584ca54d07397f7942600269
ridolenai/Day_Trip_Generator
/DayTripGenerator.py
2,583
4.15625
4
import random destinations = ["Disney World", "Oktoberfest", "Crawfish Festival", "Mawmaw's House"] restaurants = ["Applebee's", "Schnitzel Emporium", "Pizza Hut", "Sullivan's"] transportation = ['Car', 'Bicycle', '4-wheeler', 'Yee Yee Truck'] entertainment = ['Miley Cyrus Concert', 'Chainsaw Juggler', 'Sock Manufactu...
true
c21d9ce87e81316c8dc18ea15f4228cb04152e8b
ashutosh-qa/PythonTesting
/PythonBasics/First.py
509
4.28125
4
# To print anything print("This is first Pyhton program") # How to define variable in python a = 3 print(a) # How to define String Str="Ashutosh" print(Str) # Other examples x, y, z = 5, 8.3, "Test" print(x, y, z) # to print different data types - use format method print ("{} {}".format("Value is:", x)) # How to k...
true
04f373e0bb32fc3a4f4e9d77e1fc83fe368803f2
Dame-ui/Algorithms
/bubblesort.py
797
4.375
4
def bubble_sort(list_of_numbers): for i in range(len(list_of_numbers)): #run N times, where N is number of elements in a list # Last i elements are already in place # It starts at 1 so we can access the previous element for j in range(1, len(list_of_numbers) - i): # N-i elements ...
true
c44dc53c8c6aea407e29c934b9559c752a9e0216
thinhld80/python3
/python3-17/python3-17.py
1,695
4.3125
4
#Functions in depth #No Arguments def test(): print('Normal function') print('\r\n------ No Arguments') test() #Positional and Keyword Arguments def message(name,msg,age): print(f'Hello {name}, {msg}, you are {age} years old') print('\r\n------ Positional and Keyword Arguments') message('Bryan', 'good morni...
true
8bc9cb211ce9780e5d76303f4869eac4aa0d87bb
thinhld80/python3
/python3-48/python3-48.py
2,113
4.375
4
#Queues and Futures #Getting values from a thread #This is a problem for future me """ Queues is like leaving a message A Future is used for synchronizing program execution in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown, usually because...
true
0cdafb79c9df477474722c851deb8c28efe02905
thinhld80/python3
/python3-32/python3-32.py
1,055
4.15625
4
#Multiple Inheritance #Inherit from multiple classes at the same time #Vehical class class Vehical: speed = 0 def drive(self,speed): self.speed = speed print('Driving') def stop(self): self.speed = 0 print('Stopped') def display(self): print(f'Driving at {self...
true
bf0d3e56763cca5dc8024581746ab9eafcb6313b
sandeepmaity09/python_practice
/tuple.py
354
4.59375
5
#!/usr/bin/python3 empty=() # creating tuple print(type(empty)) empty=tuple() # creation tuple print(type(empty)) empty="hello", # <---- note trailing comma for create a tuple with only one item print(empty) empty=23,34,'heelo' # to create tuple x,y,z=empty # sequence unpacking of tuple print(type(x...
true
975eb35f2c500489c4e0e78f54cebb3fadb49242
sandeepmaity09/python_practice
/data_structure/disjoint2.py
254
4.125
4
#!/usr/bin/python3 #Running time algorithm = O(n) power 2 def disjoint2(A,B,C): """Return True if there is no element common to all three lists.""" for a in A: for b in B: if a==b: for c in C: if a==c: return False return True
true
ca0592b5430cca0b075845b1f9a33690ff7cbbdb
Floozutter/project-euler
/python/p004.py
1,723
4.34375
4
""" Project Euler - Problem 4 "Find the largest palindrome made from the product of two 3-digit numbers." """ from heapq import merge from typing import Iterable def palindromic(s: str) -> bool: """ Checks whether a string is a palindrome. """ size = len(s) for i in range(size // 2): if s...
true
f9b80902340fda78db2016b2e7b4d77984f5ba7f
LuisPatino92/holbertonschool-higher_level_programming
/0x06-python-classes/4-square.py
1,177
4.5625
5
#!/usr/bin/python3 """ This module has the definition of a Square class""" class Square: """ Model of a square """ def __init__(self, size=0): """ Constructor for Square Method Args: size (int): Is the size of the instance, 0 by default. """ if not isinst...
true
d098fa93e1def3706732bd290518efe0296b17ae
prathameshkurunkar7/Python_Projects
/Final Capstone Project/FindCostOfTile.py
388
4.21875
4
def find_cost(cost_per_tile, w, h): """ Return the total cost of tile to cover WxH floor """ return cost_per_tile * (w * h) w, h = (int(x) for x in input("Enter W and H : ").split()) cost_tile = float(input("Enter the cost per tile : ")) print( "Total cost of tile to cover WxH floor...
true
4fb378146c4b8c716dfd3b87c0bd3ca8caedbeb4
ticotheps/Algorithms
/stock_prices/stock_prices.py
2,711
4.375
4
#!/usr/bin/python3 #---------------Understanding the Problem--------------- # Objective: Find the largest positive difference between two numbers in a # list of 'stock prices'. # Expected Input: a list of stock prices. # Example: [1050, 270, 1540, 3800, 2] # Expected Output: an integer representin...
true
55b20ca41e543233e4fb7ba479ac3093a8b3b07d
Mauricio-Fortune/Python-Projects
/randturtle.py
1,964
4.25
4
# Mauricio Fortune Panizo # COP 2930 # Python turtle with random number # 09/10/12 import turtle import random #what do they want to draw shape = (input("Do you want a rectangle, triangle, or both?\n")) turtle.pencolor("violet") turtle.fillcolor("blue") #Rectangle if shape == "rectangle" or shape == "Rectangle" or ...
true
3c757e0e0ab2e6b6a48b8f0cc4e4a4b2360afb36
SarveshMohan89/Python-Projects
/grade.py
580
4.375
4
score = input("Enter Score: ") try: score=float(score) except: print("Enter a valid value") quit() if score >=0.9: print("A") elif score >=0.8: print("B") elif score >=0.7: print("C") elif score >=0.6: print("D") elif score <0.6: print("F") # Write a program ...
true
8d5b7d048e87d6fdd6fc7e7c09f60a2d3b17439e
SarveshMohan89/Python-Projects
/Pay.py
564
4.28125
4
hrs = input("Enter Hours:") h = float(hrs) rate = input("Enter Rate:") r= float(rate) if h <= 40: pay = h * r elif h > 40: pay = 40*r + (h-40)*r*1.5 print (pay) #Write a program to prompt the user for hours and rate per hour using input to compute gross pay.Pay the hourly rate for the hours up to 4...
true
fa757a907024fabdf8c6eca41cb99a5ad539fd6f
pBouillon/codesignal
/arcade/intro/3_Exploring_the_Waters/palindromeRearranging.py
757
4.25
4
""" Given a string, find out if its characters can be rearranged to form a palindrome. Example For inputString = "aabb", the output should be palindromeRearranging(inputString) = true. We can rearrange "aabb" to make "abba", which is a palindrome. Input/Output [execution time limit] 4 seconds (py3) [input...
true
46e7b658c7f7d1e5cbe22662800a9eedf480148a
pBouillon/codesignal
/arcade/python/1_Slithering_in_Strings/Convert_Tabs.py
1,221
4.28125
4
""" You found an awesome customizable Python IDE that has almost everything you'd like to see in your working environment. However, after a couple days of coding you discover that there is one important feature that this IDE lacks: it cannot convert tabs to spaces. Luckily, the IDE is easily customizable, so you d...
true
d9dafdd492d3d28036bae95508f9bc80582eca24
pBouillon/codesignal
/arcade/the_core/2_Corner_of_0s_and_1s/Mirror_Bits.py
505
4.1875
4
""" Reverse the order of the bits in a given integer. Example For a = 97, the output should be mirrorBits(a) = 67. 97 equals to 1100001 in binary, which is 1000011 after mirroring, and that is 67 in base 10. For a = 8, the output should be mirrorBits(a) = 1. Input/Output [execution time...
true
bcf2fee9bf1b50855607e2b748080ad319468f7b
pBouillon/codesignal
/arcade/intro/9_Eruption_of_Light/Is_MAC48_Address.py
1,343
4.53125
5
""" A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits (0 to 9 or A to F), separated by hyp...
true
c17719db8ae21f8174e7a4526c9f0e71eb92d32a
pBouillon/codesignal
/arcade/python/5_Fumbling_In_Functionnal/Fix_Result.py
1,332
4.125
4
""" Your teacher asked you to implement a function that calculates the Answer to the Ultimate Question of Life, the Universe, and Everything and returns it as an array of integers. After several hours of hardcore coding you managed to write such a function, and it produced a quite reasonable result. However, when y...
true
d93215df09999419db4bab6bc4f8eb39b2aeb127
pBouillon/codesignal
/arcade/python/6_Caravan_of_Collections/Unique_Characters.py
939
4.28125
4
""" You need to compress a large document that consists of a small number of different characters. To choose the best encoding algorithm, you would like to look closely at the characters that comprise this document. Given a document, return an array of all unique characters that appear in it sorted by their ASCII ...
true
c74785827938751410f2ca78676c167697e02ce5
digitalcourtney87/lpthw
/ex3.py
972
4.625
5
# prints the string "I will now count my chickens:" print("I will now count my chickens:") # prints hens and roosters and the calculation after each string print("Hens", 25 + 30 / 6) print("Roosters", 100 - 25 * 3 % 4) # prints the string "I wil now count my eggs" print("I will now count my eggs:") # prints the calc...
true
2c6fb80d74f7c752c451cb1d28c91fa8767de50e
RuggeroPiazza/rock_paper_scissors
/rockPaperScissors.py
1,998
4.15625
4
import random """ This program execute a given number of runs of 'Rock, Paper, Scissors' game and returns stats about it. """ choices = ['paper', 'rock', 'scissors'] winning = [('paper', 'rock'), ('rock', 'scissors'), ('scissors', 'paper')] def run(): """INPUT: no input. OUTPUT: string. The functi...
true
9aff11cc554d9567141f292091d60eea7e47473c
renegadevi/hour-calculator
/main.py
2,678
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Hour Calculator Quickly made hour calculator for 24h day clock to prevent the need of relying on a website for simple time calculations. Does the work; enter timestamps, shows results in a table of elapsed time and total hours. """ import datetime import sys import ...
true
c0da82154044bc19c0417101c83f80c25c3b160e
PdxCodeGuild/Programming102
/resources/example_lessons/unit_2/grading_with_functions.py
1,633
4.25
4
import random # for randint() #### add this function if there's time """# return True if the number is between 1 and 100 # return False otherwise def get_modifier(score): ''' return a grade modifier based on a score ''' # isolate the ones digit of the score with % 10 ones = score % 10 modifier...
true
0fb9823e4724afbace1b7b392876fc3d6661f933
pramodchahar/Python_A_2_Z
/lists/slices.py
540
4.5625
5
########################### # Slicing of List ########################### # makes new lists using slices or parts of original lists # list_name[start:end:step] #sort of similar to range(start,end,step size) num_list=[11,22,33,44,55,66,77,88,99] print(num_list[3:]) print(num_list[5:]) print(num_list[-1:]) pri...
true
2eb5d6e96aa9cc6b08b66e5724bb3b2bb7fc9960
Javenkm/Functions-Basic-2
/functions_basic2.py
2,376
4.28125
4
# 1. Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one, from the number (as the 0th element) down to 0 (as the last element). # Example: cuntdown(5) should return [5, 4, 3, 2, 1]. def countDown(num): list = [] for x in range(num, -1, -1): list.app...
true
4e0730d471146edd5bb196ff536c023e67eb5453
akash123456-hub/hello.py
/vns2.py
836
4.15625
4
''' thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] print(thislist[-4:-1]) ''' ''' class Dog: # Class Variable animal = 'dog' # The init method or constructor def __init__(self, breed, color): # Instance Variable self.breed = bre...
true
1cfd08df97ae7e4228ec082f096432bb2beee189
Brokenshire/codewars-projects
/Python/six_kyu/in_array.py
1,066
4.28125
4
# Python solution for 'Which are in?' codewars question. # Level: 6 kyu # Tags: REFACTORING, ARRAYS, SEARCH, ALGORITHMS, LISTS, DATA STRUCTURES, and STRINGS. # Author: Jack Brokenshire # Date: 11/06/2020 import unittest from re import search def in_array(array1, array2): """ Finds which words within array1 a...
true
850ef1bc3215064426abed63def8de9a52fd8cc4
Brokenshire/codewars-projects
/Python/six_kyu/likes.py
1,552
4.375
4
# Python solution for 'Who likes it?' codewars question. # Level: 6 kyu # Tags: Fundamentals, Formatting, Algorithms, and Strings. # Author: Jack Brokenshire # Date: 19/02/2020 import unittest def likes(names): """ You probably know the "like" system from Facebook and other pages. People can "like" blog post...
true
a6c9f153e08a44a65cd9cd314229b7b18a7a60f6
Brokenshire/codewars-projects
/Python/seven_kyu/find.py
636
4.53125
5
# Python solution for 'Sum of all the multiples of 3 or 5' codewars question. # Level: 7 kyu # Tags: FUNDAMENTALS. # Author: Jack Brokenshire # Date: 18/05/2020 import unittest def find(n): """ Finds the sum of all multiples of 3 and 5 of an integer. :param n: an integer value. :return: the sum of al...
true
f66d99f8800f29f0da719a02ca7df5666637ff11
Brokenshire/codewars-projects
/Python/seven_kyu/square_digits.py
891
4.4375
4
# Python solution for 'Simple Pig Latin' codewars question. # Level: 7 kyu # Tags: Fundamentals, Mathematics, Algorithms, and Numbers # Author: Jack Brokenshire # Date: 11/02/2020 import unittest def square_digits(num): """ Welcome. In this kata, you are asked to square every digit of a number. For examp...
true
19937ad4042fe640d47bc40486434f0a2fd86c3e
Brokenshire/codewars-projects
/Python/four_kyu/permutations.py
962
4.1875
4
# Python solution for 'Permutations' codewars question. # Level: 4 kyu # Tags: ALGORITHMS, PERMUTATIONS, and STRINGS. # Author: Jack Brokenshire # Date: 13/05/2020 import unittest import itertools def permutations(string): """ Create all permutations of an input string and remove duplicates, if present. This...
true
e48a8a7273db7f74a15710e01769a58535e3fdcd
Brokenshire/codewars-projects
/Python/seven_kyu/in_asc_order.py
1,046
4.125
4
# Python solution for "Are the numbers in order?" codewars question. # Level: 7 kyu # Tags: ALGORITHMS, FUNDAMENTALS, MATHEMATICS, NUMBERS, CONTROL FLOW, BASIC LANGUAGE FEATURES, and OPTIMIZATION. # Author: Jack Brokenshire # Date: 06/04/2020 import unittest def in_asc_order(arr): """ Determines if the given...
true
cf815b0af79820535c15167786267ec93245cfc2
Brokenshire/codewars-projects
/Python/six_kyu/count_smileys.py
1,811
4.21875
4
# Python solution for 'Count the smiley faces!' codewars question. # Level: 6 kyu # Tags: Fundamentals, Regular Expressions, Declarative Programming, Advanced Language Features, and Strings. # Author: Jack Brokenshire # Date: 06/02/2020 import unittest def count_smileys(arr): """ Given an array (arr) as an a...
true
a5746557d0b41917a459998bc393246117f4ba40
Brokenshire/codewars-projects
/Python/eight_kyu/reversed_string.py
725
4.15625
4
# Python solution for 'Reversed Strings' codewars question. # Level: 8 kyu # Tags: FUNDAMENTALS and STRINGS. # Author: Jack Brokenshire # Date: 27/06/2020 import unittest def solution(string): """ Complete the solution so that it reverses the string passed into it. :param string: a string value. :ret...
true
ffa315450ca504e52aa8d42b1a66e75bc8273040
Brokenshire/codewars-projects
/Python/seven_kyu/reverse_letter.py
880
4.25
4
# Python solution for 'Simple Fun #176: Reverse Letter' codewars question. # Level: 7 kyu # Tags: FUNDAMENTALS. # Author: Jack Brokenshire # Date: 03/05/2020 import unittest def reverse_letter(string): """ Given a string str, reverse it omitting all non-alphabetic characters. :param string: a string valu...
true
3187a208fd79756ce2f348354e0439249a5d786a
Brokenshire/codewars-projects
/Python/six_kyu/find_missing_number.py
991
4.21875
4
# Python solution for 'Number Zoo Patrol' codewars question. # Level: 6 kyu # Tags: ALGORITHMS, PERFORMANCE, MATHEMATICS, and NUMBERS. # Author: Jack Brokenshire # Date: 09/05/2020 import unittest def find_missing_number(numbers): """ akes a shuffled list of unique numbers from 1 to n with one element missin...
true
2227299998c5819a79b6ad295b37d46e55ad626f
Brokenshire/codewars-projects
/Python/seven_kyu/odd_or_even.py
972
4.46875
4
# Python solution for 'Odd or Even?' codewars question. # Level: 7 kyu # Tags: Fundamentals, Arithmetic, Mathematics, Algorithms, Numbers, and Arrays. # Author: Jack Brokenshire # Date: 15/02/2020 import unittest def odd_or_even(arr): """ Given a list of numbers, determine whether the sum of its elements is ...
true
a77599b1b182804ef47d14662e3e4a6f8640af86
Brokenshire/codewars-projects
/Python/seven_kyu/get_count.py
806
4.1875
4
# Python solution for 'Vowel Count' codewars question. # Level: 7 kyu # Tags: Fundamentals, Strings, and Utilities # Author: Jack Brokenshire # Date: 09/02/2020 import unittest def get_count(inputStr): """ Return the number (count) of vowels in the given string. We will consider a, e, i, o, and u as vowe...
true
4c1ef91c4464eb933dfeb493523e27d408a89b30
Brokenshire/codewars-projects
/Python/seven_kyu/even_chars.py
1,045
4.5
4
# Python solution for 'Return a string's even characters.' codewars question. # Level: 7 kyu # Tags: FUNDAMENTALS, STRING, AND SARRAYS. # Author: Jack Brokenshire # Date: 16/08/2020 import unittest def even_chars(st): """ Finds all the even characters in a string. :param st: string value. :return: a ...
true
1790d87e28600368578483b8c0511619df107563
Brokenshire/codewars-projects
/Python/seven_kyu/get_middle.py
1,284
4.15625
4
# Python solution for 'Get the Middle Character' codewars question. # Level: 7 kyu # Tags: Fundamentals, and Strings # Author: Jack Brokenshire # Date: 10/02/2020 import unittest def get_middle(s): """ You are going to be given a word. Your job is to return the middle character of the word. If the word's len...
true
204d75a486784b74f705a51a2edc7f5989d5b554
Brokenshire/codewars-projects
/Python/five_kyu/sum_pairs.py
1,845
4.1875
4
# Python solution for "Sum of Pairs" codewars question. # Level: 5 kyu # Tags: FUNDAMENTALS, PARSING, ALGORITHMS, STRINGS, MEMOIZATION, DESIGN PATTERNS, and DESIGN PRINCIPLES. # Author: Jack Brokenshire # Date: 08/04/2020 import unittest def sum_pairs(ints, s): """ Finds the first pairs to equal the integer ...
true
0f702ff15d1d5b9145082f6402c50e7a282d49a8
Brokenshire/codewars-projects
/Python/eight_kyu/make_negative.py
714
4.21875
4
# Python solution for 'Return Negative' codewars question. # Level: 8 kyu # Tags: FUNDAMENTALS and NUMBERS. # Author: Jack Brokenshire # Date: 11/04/2020 import unittest def make_negative(number): """ Make a given number negative. :param number: an integer value. :return: the integer as a negative nu...
true
8ce90fd19cf8df52af008dac2f8c61ad9054b3fb
Brokenshire/codewars-projects
/Python/five_kyu/pig_it.py
880
4.21875
4
# Python solution for 'Square Every Digit' codewars question. # Level: 5 kyu # Tags: Algorithms # Author: Jack Brokenshire # Date: 11/02/2020 import unittest def pig_it(text): """ Move the first letter of each word to the end of it, then add "ay" to the end of the word. Leave punctuation marks untouched....
true
5696eedb1fce1317b7e599a1a3d82c11ed318297
Brokenshire/codewars-projects
/Python/eight_kyu/bool_to_word.py
767
4.1875
4
# Python solution for 'Convert boolean values to strings 'Yes' or 'No'.' codewars question. # Level: 8 kyu # Tags: FUNDAMENTALS, BOOLEAN, and SBEST PRACTICES. # Author: Jack Brokenshire # Date: 01/05/2020 import unittest def bool_to_word(boolean): """ Complete the method that takes a boolean value and return...
true
cfa7febef65c5683971080f1119d2734c91dc229
thekuldeep07/SDE-SHEET
/majority element.py
745
4.15625
4
# Question :- find the majority element i.e which appear more than n//2 times # method1:- using two nested loops # o(n2) # method2:- using hashmap # O(n) # mrthod 3 :- using moore voting algorithm def findMajority(nums): maj_index=0 count=0 for i in range(len(nums)): if nums[i]== nums[maj_index...
true
b1d3f6edbe21e683f6e8596c56ad8a8b0a288ded
Zizo001/Random-Password-Generator
/RandomPasswordGenerator.py
1,798
4.34375
4
""" Author: Zeyad E Description: random password generator that uses characters, numbers, and symbols Last Modified: 6/9/2021 """ import random import string import pyperclip #external library used to copy/paste to clipboard def randomPassword(length): characters = string.ascii_letters + string.dig...
true
54bab2af89fe1cb539ebafc3777a39971492d69b
stoltzmaniac/data_munger
/basics.py
1,293
4.40625
4
def mean(data: list) -> float: """ Calculates the arithmetic mean of a list of numeric values :param data: list of numeric values :return: float """ data_mean = sum(data) / len(data) return data_mean def variance(data: list) -> float: """ Calculates the variance of a list of numeri...
true
47355faeb3b11b5eed30d09453b463dd564ce36c
carlocamurri/NeuralNetworksKarpathyTutorial
/neural_network_practice.py
2,065
4.40625
4
# Simplified version of multiplication gate to return the output or the gradient of the input variables def multiply_gate(a, b, dx=1, backwards_pass=False): if not backwards_pass: return a * b else: da = b * dx db = a * dx return da, db def add_gate(a, b, dx=1, backwards_pass=F...
true
0676e98b993097962e0014a31daabedc5c1939f5
rsinger86/software-testing-udacity
/lessons/luhns_algorithm.py
1,351
4.34375
4
# concise definition of the Luhn checksum: # # "For a card with an even number of digits, double every odd numbered # digit and subtract 9 if the product is greater than 9. Add up all # the even digits as well as the doubled-odd digits, and the result # must be a multiple of 10 or it's not a valid card. If the card ...
true
090d2c08fc310eec386602a8686fa8694265967e
alfredleo/ProjectEuler
/problem1.py
2,667
4.5
4
import unittest from utils import performance def multiplesof3and5(to): """ If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. https://projecteuler.net/problem=1 "...
true