blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
3f7e318da7c059e17a7e31761311b49123d30291
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_425.py
709
4.125
4
def main (): temp = (float (input ("What is the temperature: "))) scale = (str (input ("Please enter 'C' for Celsius or 'K' for Kelvin: "))) if (scale == 'C'): if (temp >= 100): print ("At this temperature, water is a gas.") elif (temp <= 0): print ("At this temperatu...
true
84504ced69b52147fdcc671ce10cd68d71e498f2
MAPLE-Robot-Subgoaling/IPT
/data/HW4/hw4_054.py
481
4.125
4
def main(): EVEN = 0 ODD = 1 height = int(input("Please enter starting height of the hailstorm: ")) print("Hail is currently at height" , height) while height !=1: if height % 2 == EVEN: height = height // 2 print("Hail is currently at height" , height) el...
true
c7c6cf60781c3541d6d56ba435aa78f8f969edbc
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_029.py
775
4.125
4
def main(): temp = float(input("Please enter the temperature: ")) letter = input("Please enter 'C' for Celsius or 'K' for Kelvin: ") if temp <= 0 and letter == 'C': print("At this temperature, water is a (frozen) solid.") elif temp >= 1 and temp <= 99 and letter == 'C': print("At this te...
true
6ee976cc3bab4e98489059e23009ed4f722ecb8f
MAPLE-Robot-Subgoaling/IPT
/data/HW5/hw5_078.py
427
4.1875
4
width = int(input("Please enter width: ")) height = int(input("Please enter height: ")) symbol_outline = input("Please enter a symbol for the outline:") symbol_fill = input("Please enter a symbol for the fill:") def main(): forl_row = symbol_outline*width mid_row = symbol_outline+(symbol_fill*(width-2))+symbol...
true
1c5c9abdc59ed57e5213d37b8e9d541ee5b73de6
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_043.py
766
4.125
4
def main(): enterTemp = float(input("Please enter the temperature: ")) typeTemp = input("Please enter 'C' for Celsisus, or 'K' for Kelvin: ") if typeTemp == "K" and enterTemp >= 373.16: print("At this temperature, water is a gas.") elif typeTemp == "K" and enterTemp <= 273.16: print("At ...
true
dbb76edf02c9c3082671fd89df2bcdd9220a2bb6
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_028.py
790
4.125
4
def main(): unit = input("What unit are you using, enter 'C' for celcius or 'K' for Kelvin") temp = float(input("What is the temperature?")) if (temp <= 0) and (unit == "C") : print("At this temperature, water is a (frozen) solid") elif (temp >= 100) and (unit == "C") : print("At this te...
true
5991c2fbf4a1a987cde366a7a784d1db12fdffc5
MAPLE-Robot-Subgoaling/IPT
/data/HW4/hw4_431.py
550
4.21875
4
def main(): currentHeight = int(input("Please enter the starting height of the hailstone: ")) print("Hail is currently at height",(currentHeight)) while currentHeight != 1: if (currentHeight % 2) == 0: print("Hail is currently at height", currentHeight / 2) currentHeight = (c...
true
f6c13e0b0478f843c4ab72ff4689aaad93b24764
MAPLE-Robot-Subgoaling/IPT
/data/HW4/hw4_030.py
393
4.28125
4
STOP_HEIGHT = 1 def main (): hailHeight = int ( input ("Please enter the starting height of the hailstone: ")) while hailHeight != STOP_HEIGHT: if hailHeight % 2 == 0: print ("Hail is currently at", hailHeight) hailHeight = hailHeight // 2 else: print ("Hail is currently at", hailHeight) hail...
true
f20872e50a04cfe8ecf00603cd58697ca47bda6a
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_037.py
782
4.125
4
def main(): temp = float(input("Please enter your temperature: ")) scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ") if scale == "C" and temp >= 100: print("At this temperature, the water is a gas.") elif scale == "C" and (temp <100 and temp >0): print("At this...
true
bab242cced1e1ad5251f1876544fa92f2c8f4c73
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_359.py
1,070
4.3125
4
temp = float(input("Please enter the temperature: ")) scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ") MELTING_POINT_C = 32 BOILING_POINT_C = 100 MELTING_POINT_K = 273.15 BOILING_POINT_K = 373.15 def main(): if scale == "C": if temp >= 0 and temp < MELTING_POINT_C: ...
true
c75d93e681c3249f20724da3ac8f6719b683021f
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_332.py
743
4.125
4
def main(): temp = float(input("What is the temperature in degrees? ")) scale = input("What is the scale: Celsius (C) or Kelvin (K)? ") if scale == "C": if temp <= 0: print("At this temperature, water is a solid.") elif (temp > 0) and (temp < 100): print("At this temp...
true
0eb4be20b6512b4652c20a39b17e828f3659b886
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_329.py
842
4.25
4
def main(): temperature = float(input("Please enter the temperature:")) units = input("Please enter 'C' for Celcius or 'K' for Kelvin:") if units == "K": ctemp = temperature - 273.2 if ctemp <= 0: print ("At this temperature, water is a (frozen) solid.") elif ctemp > 0 an...
true
4f63d8015f9941746f8d00760d7de222308dd31a
GMwang550146647/network
/1.networkProgramming/2.parallelProgramming/3.coroutines/2.pythonCoroutines/2.Awaitables.py
2,275
4.15625
4
""" 三种 Awaitable Objects 1.Coroutines 2.Tasks 3.Futures """ import asyncio import concurrent.futures """ 1.Coroutines async 包装的函数都会转换成一个Coroutines函数,如果没有await,函数不会调用,会返回Coroutines对象 """ def coroutines(): """用于直接运行的任务""" async def nested(): return 42 async def main(): # Nothing happens i...
true
9c93463506fcd2ddf6ba8b205ab3a7f27ebaf944
Azure-Whale/Kazuo-Leetcode
/Array/238. Product of Array Except Self.py
2,176
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' @File : 238. Product of Array Except Self.py @Time : 10/21/2020 10:37 PM @Author : Kazuo @Email : azurewhale1127@gmail.com @Software: PyCharm ''' class Solution: """ The solution is to create two lists within same length as the given array, since each...
true
ad4e5783ab8452552b9e606143057fab8bfcdf84
Hunters422/Basic-Python-Coding-Projects
/python_if.py
290
4.25
4
num1 = 12 key = True if num1 == 12: if key: print('Num1 is equal to Twelve and they have the key!') else: print('Num1 is equal to Twelve and they do no have the key!') elif num1 < 12: print('Num1 is less than Twelve!') else: print('Num1 is not eqaul to Twelve!')
true
f1b18f3fc959db741f9d42643a149d175dd1f162
zeejaykay/Python_BootCamp
/calculator.py
1,753
4.34375
4
# using while loop to continuously run the calculator till the user wants to exit while(True): print("\n Zaeem\'s Basic Calculator\n") print("Please enter two numbers on which you wish to perform calculation's and the operand\n") # displaying instructions num_1 = input("Please enter the 1st number:\n") ...
true
88e69cba39a474480bfb14b421a2e600392199b9
TrendingTechnology/rnpfind
/website/scripts/picklify.py
1,863
4.25
4
""" Picklify is a function that works similar to memoization; it is meant for functions that return a dictionary. Often, such functions will parse a file to generate a dictionary that maps certain keys to values. To save on such overhead costs, we "picklify" them the first time they are called (save the dictionary in a...
true
03ce63b031ca790b622d518b4b8813642fdf46b6
Gafficus/Delta-Fall-Semester-2014
/CST-186-14FA(Intro Game Prog)/N.G.Chapter5/N.G.Project2.py
954
4.53125
5
#Created by: Nathan Gaffney #21-Sep-2014 #Chapter 5 Project 1 #This program tell the user where they would go. directions = {"north" : "Going north leads to the kitchen.", "south" : "GOing south leads to the dining room.", "east" : "Going east leads to the entry.", "west" : "Go...
true
dc04fb45db7a16bae44deaebf0e4c7729f46c6ca
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 10 Tuples/Code/Lab 10.6 Tuples are Comparable.py
488
4.125
4
__author__ = 'Kevin' # 08/04/2015 # Tuples are Comparable # The comparison operators work with tuples and other sequences. If the first item is equal, Python goes on to the # next element, and so on, until it finds elements that differ. print (0, 1, 2) < (5, 1, 2) # True print (0, 1, 2000000) < (0, 3, 4) # True prin...
true
3a7ecaea275e0022dc6bb928872e6d9a11360ef7
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 9 Dictionaries/Code/Lab 9.10 Two Iteration Variables.py
844
4.28125
4
__author__ = 'Kevin' # 06/04/2015 # We loop through the key-value pairs in a dictionary using *two* iteration variables. # Each iteration, the first variable is the key and the second variable is the corresponding value for the key. jjj = {'chuck': 1, 'fred': 42, 'jan': 100} for aaa,bbb in jjj.items(): print aaa...
true
b9516444d75abd0141d923136db6dfe47c7ad99d
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 8 Lists/Code/Lab 8.10 Building a list from scratch.py
448
4.4375
4
__author__ = 'Kevin' # 05/04/2015 # BUILDING A LIST FROM SCRATCH # We can create an empty list and then add elements using the append method stuff = list() print stuff stuff.append("book") print stuff other_stuff = [] print other_stuff other_stuff.append("other book") print other_stuff # The list stays in order ...
true
18a316129cc590ba81d98d033617cd7776154603
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 7 Files/Code/Lab 7.1 Opening a File.py
849
4.125
4
__author__ = 'Kevin' # 24/03/2015 # Opening a File # Before we can read the contents of the file, we must tell Python which file we are going to work with and what we will # be doing with the file # This is done with the open() function # open() returns a 'file handle' - a variable used to perform operations on the ...
true
51ce3c640601771132427ca633d37b66e0d86302
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 3 Conditional/Week 3.3 Try and Except.py
340
4.25
4
# You surround a dangerous section of code with try and except # If the code in the try works - the except is skipped # If the code in the try fails - it jumps to the except section astr = 'Hello Bob' try: istr = int(astr) except: istr = -1 print "First",istr astr = '123' try: istr = int(astr) except: istr = -1 ...
true
1c323c793a58d3736ccbec00ffbccb447f7ca21c
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 9 Dictionaries/Code/Lab 9.8 Definite Loops and Dictionaries.py
376
4.4375
4
__author__ = 'Kevin' # 06/04/2015 # Even though dictionaries are not stored in order, we can write a for loop that goes through all the entries in a # dictionary - actually it goes through all of the keys in the dictionary and looks up the values counts = { 'chuck' : 1 , 'fred' : 42, 'jan': 100} for key in counts: ...
true
44df3f26086799bea3f88ec4e814ee785fba53ef
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 8 Lists/Code/Lab 8.1 Lists Introduction.py
1,057
4.1875
4
__author__ = 'Kevin' # 01/04/2015 # A List is a kind of Collection # - A collection allows us to put many values in a single "variable" # - A collection is nice because we can carry all many values around in one convenient package. friends = ['Joseph', 'Glenn', 'Sally'] carryon = ['socks', 'shirt', 'perfume'] print f...
true
151748740604378d807b3bc5fd24e1be09c73350
kevmct90/PythonProjects
/Python-Programming for Everybody/Week 6 Strings/Code/Lab 6.15 Making everythin UPPERCASE.py
350
4.21875
4
__author__ = 'Kevin' # 23/03/2015 # You can make a copy of a string in lower case or upper case. # Often when we are searching for a string using find() - we first convert the string to lower case # so we can search a string regardless of case. greet = 'Hello Bob' nnn = greet.upper() print nnn # HELLO BOB www = gree...
true
4ff057f5206a6d6509d5de02f88c51b495ae9bda
ScoJoCode/ProjectEuler
/problem19/main.py
881
4.15625
4
import time start = time.time() def isLastDay(day,year,month): if day==31 and (month==1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12): return True if day==30 and (month ==4 or month == 6 or month == 9 or month == 11): return True if month == 2 and day==28: if ...
true
3d698dbd2f2e42af6f8abdd40e96d43c5bcf409a
LiawKC/CS-Challenges
/GC08.py
627
4.21875
4
weight = float(input("What is your weight")) height = float(input("What is your height in m")) BMI = weight / height**2 print(BMI) if BMI < 18.5: print("Bro head to mcdonalds have a big mac or 2 you're probably anorexic") if BMI < 25 and BMI > 18.5: print("Ok, you're average but don't get fat or we...
true
ed224eb604a4783850d5dbecb0b25f0c582fcdc8
sgetme/python_turtle
/turtle_star.py
1,104
4.1875
4
# first we need to import modules import turtle from turtle import * from random import randint # Drawing shape # I prefer doing this with a function def main(): # set background color of turtle bgcolor('black') # create a variable called H H = 1 # set speed of turtle ...
true
980e284b513a95820bae35101c10120b4dd1e208
MohamedNour95/Py-task1
/problem9.py
240
4.5
4
PI = 3.14 radius = float(input('Please enter the radius of the circle:')) circumference = 2 * PI * radius area = PI * radius * radius print("Circumference Of the Circle = "+ str(circumference)) print("Area Of the Circle = "+ str(area))
true
4ec65a6426dfa1e36d68db08cdeb274fca9840d3
miliart/ITC110
/nth_fibonacci_ch8.py
1,116
4.25
4
# A program to calculate the nth spot in the Fibonacci # Per assignment in the book we start at 1 instead of which is the result of 0 plus 1 # by Gabriela Milillo def main(): n= int(input("Enter a a spot in the Fibonacci sequence: "))#variable n is the user input #per the book Fibonacci sequence starts at ...
true
10fdb82b732b524a4a9526758e8579e468f9aae0
mdhatmaker/Misc-python
/interview-prep/geeks_for_geeks/bit_magic/rotate_bits.py
1,506
4.40625
4
import sys # https://practice.geeksforgeeks.org/problems/rotate-bits/0 # https://wiki.python.org/moin/BitwiseOperators # Given an integer N and an integer D, you are required to write a program to # rotate the binary representation of the integer N by D digits to the left as well # as right and print the results in ...
true
9dcbb78a4064439289522558200e106eb204d665
mdhatmaker/Misc-python
/interview-prep/geeks_for_geeks/divide_and_conquer/binary_search.py
1,507
4.1875
4
import sys # https://practice.geeksforgeeks.org/problems/binary-search/1 # Given a sorted array A[](0 based index) and a key "k" you need to complete # the function bin_search to determine the position of the key if the key # is present in the array. If the key is not present then you have to return -1. # The arg...
true
52fa21fa353bc13fb7439569009b710fa37b6a46
mdhatmaker/Misc-python
/interview-prep/geeks_for_geeks/tree_and_bst/print_bottom_view.py
2,329
4.34375
4
import sys from BinaryTree import BinaryNode, BinaryTree from StackAndQueue import Stack, Queue # https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 # Given a binary tree, print the bottom view from left to right. # A node is included in bottom view if it can be seen when we look at the tree fr...
true
5c29aa549d09b85456b9ee25e5895d9aefd369dd
pi-bansal/studious-happiness
/DP_Practice/Tabulation/how_sum.py
887
4.125
4
def how_sum(target_sum, numbers): # Expected return is an array of integers that add up to target_sum if target_sum == 0: # Zero using empty array return [] # Init the table with null values sum_table = [None] * (target_sum + 1) # Seed value for 0 sum_table[0] = [] for ind...
true
d25cbf0e3769be7d5e4e4a71d2b4deaebd721052
pi-bansal/studious-happiness
/DP_Practice/memoization/how_sum_basic.py
645
4.125
4
def how_sum(target_sum, numbers): """Function that return a subset of numbers that adds up to the target_sum""" if target_sum == 0: return [] if target_sum < 0: return False for num in numbers: remainder = target_sum - num return_val = how_sum(remainder, numbers) ...
true
3c4a36e49bff8e952264bf32b54f59a734ef7535
vv1nn1/dsp
/python/q8_parsing.py
1,679
4.625
5
# The football.csv file contains the results from the English Premier League. # The columns 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 t...
true
d92f3b6c81eff37101c26324694e872272f8762c
leerobert/python-nltk-intro
/code/process.py
1,022
4.125
4
# Sample code for processing a file containing lines of raw text import nltk raw = open("reviews.txt").read() # read in the entire file as a single raw string tokens = nltk.word_tokenize(raw) # tokenizes the raw string text = nltk.Text(tokens) # generate the text object # Cleaning the text of punctuation impo...
true
e8b0861e65e8dde5a5eeb13f52763988cb0ac317
szhao13/interview_prep
/stack.py
498
4.125
4
class Stack(object): def __init__(self): """Initialize an empty stack""" self.items = [] def push(self, item): """Push new item to stack""" self.items.append(item) def pop(self): """Remove and return last item""" # If the stack is empty, return None # (it would also be reasonable to throw an excepti...
true
2c5569c99d54e1fa5aa523b6071862f237bc6334
DemondLove/Python-Programming
/CodeFights/28. alphabetShift.py
951
4.3125
4
''' Given a string, your task is to replace each of its characters by the next one in the English alphabet; i.e. replace a with b, replace b with c, etc (z would be replaced by a). Example For inputString = "crazy", the output should be alphabeticShift(inputString) = "dsbaz". Input/Output [execution time limit] 4 s...
true
fc2a2ca8d11b1c90f35118263132230e1b544ebb
DemondLove/Python-Programming
/CodeFights/42. Bishop and Pawn.py
1,450
4.125
4
''' Given the positions of a white bishop and a black pawn on the standard chess board, determine whether the bishop can capture the pawn in one move. The bishop has no restrictions in distance for each move, but is limited to diagonal movement. Check out the example below to see how it can move: Example For bishop...
true
08cc42adae9c5077db60e1f49607b7a8c0fb9ddf
jaredscarr/data-structures
/linked_list.py
2,235
4.125
4
# -*- coding: utf-8 -*- class Node(object): """Construct Node object.""" def __init__(self, val): """Initialize node object.""" self.val = val self.next = None class LinkedList(object): """Handle creation of a linked list.""" def __init__(self, iterable=None): """In...
true
e3c870a1069eee7c09d0d2c66f7e1d7a04f8127c
jiangyu718/pythonstudy
/base/integrative.py
509
4.15625
4
listone = [2, 3, 4] listtwo = [2*i for i in listone if i > 2] print(listtwo) def powersum(power, *args): '''Return the sum of each argument raised to specified power.''' total = 0 for i in args: total += pow(i, power) return total exec('print(powersum(2,3,4))') exec('print(powersum(2,10))') eva...
true
3ceab3ad04a845fcf81f46c24b4b612c7d7e3dc9
booji/Exercism
/python/prime-factors/prime_factors.py
707
4.28125
4
import math def prime_factors(natural_number): factors = [] i = 2 # Find all prime '2' the remainder will be odd. while natural_number%i == 0: natural_number = natural_number // i factors.append(i) # Go up to sqrt(natural_number) as prime*prime cannot be greater then # natural_...
true
790d11daed36af486c57a4cb4a017798b1a9dcc4
SimonCCooke/CodeWars
/SmallestInteger.py
446
4.1875
4
"""Given an array of integers your solution should find the smallest integer. For example: Given [34, 15, 88, 2] your solution will return 2 Given [34, -345, -1, 100] your solution will return -345 You can assume, for the purpose of this kata, that the supplied array will not be empty.""" def findSmallestInt(arr): ...
true
38f7f4defa13ac0cc35d78a54b90d7764f9e6116
kwaper/iti0102-2018
/pr08_testing/shortest_way_back.py
1,586
4.25
4
"""Find the shortest way back in a taxicab geometry.""" def shortest_way_back(path: str) -> str: """ Find the shortest way back in a taxicab geometry. :param path: string of moves, where moves are encoded as follows:. N - north - (1, 0) S - south - (-1, 0) E - east - (0, 1) W - west ...
true
17f70272ddf81483bcf5b5c36377659a43174a8d
amiraHag/Python-Basic
/basic datatypes/variables.py
584
4.4375
4
#print any text using print function print("Hello World!") """store value in variables""" x=5 y=6 z= x+y print(z) """ know the type of the variable by using type()""" print(type(z)) #make operations on numbers x= 3+4*5 print(x) # arithmatic operators four basic - + * / # ** power ()parenthesis- use to identify whi...
true
d2fd5afd38c0191cdc657af4e99e62da817b7f0f
theshevon/A2-COMP30024
/adam/decision_engine.py
2,458
4.1875
4
from math import sqrt from random import randint class DecisionEngine(): """ Represents the agents 'brain' and so, decides which node to move to next. """ EXIT = (999, 999) colour = None exit_nodes = None open_node_combs = None init_node...
true
8273da9ef7fb33ab57d238d677465cebd66a07b0
narokiasamy/internship1
/06-20-19/temperatureConverter.py
548
4.25
4
# temperature must be typed with corresponding temperature scale unit! (ex: 32F or 68C) temperature = str(input("temperature reading: ")) # temperature conversions if "C" in temperature: removeLetter = int(temperature.rstrip("C")) fahrenheitCalculation = (int((removeLetter * 1.8) + 32)) print (str(fahrenheitCalc...
true
260ebcd387e66bf0a17576468d5e6e1c3b6cee61
manerain/savy
/proj02/proj02_02.py
598
4.4375
4
# Name: # Date: # proj02_02: Fibonaci Sequence """ Asks a user how many Fibonacci numbers to generate and generates them. The Fibonacci sequence is a sequence of numbers where the next number in the sequence is the sum of the previous two numbers in the sequence. The sequence looks like this: 1, 1, 2, 3, 5, 8, 13....
true
756807939ce427d376446b51d12d229acc3099cc
rajunrosco/PythonExperiments
/CollectionFunctions/CollectionFunctions.py
2,174
4.125
4
import os import sys from functools import reduce def FilterTest(): keylist = ["a","a|ps4","b","b|ps4","b|win64","c","c|win64"] # filter list with lambda function that returns all strings that contain "ps4" # filter() takes a function evaluates to "true", items that you want in the list # in the case ...
true
f2a5dc0eb57b10d0ccc0acc17c6b5bf3b060c585
anuragdogra2192/Data_structures_with_python3
/arrays/TwoSumII_unique_pairs.py
1,839
4.21875
4
''' Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= first < second <= numbers.length. Return the indices of the two numbers, ...
true
c529568c0c22bc9cbee2c64265c8c32147c310e8
anuragdogra2192/Data_structures_with_python3
/arrays/ReturnAnArrayOfPrimes/Return_array_of_primes.py
870
4.34375
4
""" Write a program that takes an integer argument and returns all the primes between 1 and that integer. For example, if the input is 18, you should return [2, 3, 5, 7, 11, 13, 17] Hint: Exclude the multiples of primes. """ #Given n, return all primes up to and including n. def generate_primes(n): p...
true
20099604968983eb02c4ec2b0f9c67600afcf002
anuragdogra2192/Data_structures_with_python3
/strings/integer_to_string.py
899
4.28125
4
""" Integer to string Built-in functions used in the code 1) ord() The ord() function returns an integer representing the Unicode character. ord('0') - 48 ord('1') - 49 : : ord('9') - 57 2) chr() Python chr() function takes integer argument and return the string representing a character at...
true
66ca2398e71e7faf0042e69596658d19d25a9409
anuragdogra2192/Data_structures_with_python3
/LargeAssociationItems.py
2,558
4.28125
4
""" My approach: DFS Question: In order to improve customer experience, Amazon has developed a system to provide recommendations to the customer regarding the item they can purchase. Based on historical customer purchase information, an item association can be defined as - If an item A is ordered by a customer, then ...
true
1bb0230e9ca9ae6404d40e7fd5a6091f4cbdb503
600rrchris/Python-control-flow-lab
/exercise-2.py
490
4.3125
4
# exercise-02 Length of Phrase # Write the code that: # 1. Prompts the user to enter a phrase: # Please enter a word or phrase: # 2. Print the following message: # - What you entered is xx characters long # 3. Return to step 1, unless the word 'quit' was entered. word = input('Enter "Please enter a word or ...
true
525fa36066c159ccd4a5f921f006ad71dbc47777
saurav-singh/CS260-DataStructures
/Assignment 3/floyd.py
1,718
4.375
4
#!usr/bin/env python # # Group project: Floyd's algorithm # Date: 03/13/2019 # # It should be noted that this implementation follows the one in the textbook """{Shortest Paths Program: shortest takes an nXn matric C of arc costs and produces nXn matrix A of lengths of shortst paths and an nXn matrix P giving a point i...
true
0725be1066a074d73d764b67b8fe589b41b33cd7
rosewambui/NBO-Bootcamp16
/fizzbuzz.py
278
4.1875
4
"""function that checks the divisibility of 3, 5 or both""" """a number divisible by both 3 and 5 id a divisor 15, divisibility rule""" def fizz_buzz(num): if num%15==0: return "FizzBuzz" elif num%5==0: return "Buzz" elif (num%3==0): return "Fizz" else: return num
true
6b596be7dbe7be8359e78e6bec3dba581d1762c7
mhorist/FunctionPractice
/FunkyPractice06.py
246
4.3125
4
# Write a Python program to reverse a string. def strRevers(charString): rstr = '' index = len(charString) while index > 0: rstr += charString[index - 1] index = index - 1 print(rstr) strRevers("abc def ghi jkl")
true
2db7e00677625efb1119dab3fd48a6de2c3d1567
eflagg/dictionary-restaurant-ratings
/restaurant-ratings.py
1,861
4.40625
4
# your code goes here import random def alphabetize(filename): """Alphabetizes list of restaurants and ratings Takes text file and turns it into dictionary in order to print restaurant_name with its rating in alphabetical order """ username = raw_input("Hi, what's your name? ") print "Hi %s!"...
true
8629533b3301fd37e7cd41c4cfaecbf9677efe92
boxa72/Code_In_Place
/khansoleAcademy.py
1,414
4.25
4
""" Prints out a randomly generated addition problem and checks if the user answers correctly. """ import random MIN_RANDOM = 10 # smallest random number to be generated MAX_RANDOM = 99 # largest random number to be generated THREE_CORRECT = 3 # constant for the loop def main(): math_test() def math_...
true
30c32e1a5cd8c9468a7d3583f77524de86885683
JessicaGarson/Deduplicate_playtime
/dedupe.py
1,373
4.40625
4
# Challenge level: Beginner # Scenario: You have two files containing a list of email addresses of people who attended your events. # File 1: People who attended your Film Screening event # https://github.com/shannonturner/python-lessons/blob/master/section_09_(functions)/film_screening_attendees.txt # # ...
true
3634e3d694a98a2dd178c9f431874a53ffe8cc20
0xlich/python-cracking-codes-examples
/caesar.py
1,178
4.25
4
# Caesar Cypher import pyperclip #The string to be encrypted #print ('Please enter the message: ') #message = input() message = 'fVDaOPZDPZDHTHgPUNDKVVN' # The encryption key key = 7 #Wheter the program encrypts or decrypts: mode = 'decrypt' # Set to either 'encrypt' or 'decrypt' #Every possible symbol SYMBOLS = ...
true
d566fbf02375e2a53983be614c73f58cfec61951
gitbrian/lpthw
/ex15.py
569
4.21875
4
#imports the argv module from sys import argv #assigns variables to the arguments in argv # script, filename = argv # print "The script running this is named %r." % script #assigns the open file to the variable 'txt' # txt = open(filename) # prints the filename of the text file # print "Here's your file %r:" % filen...
true
53fe312095c05dc9d24e255d4062b24862c2e27c
ejudd72/beginner-python
/notes/numbers.py
807
4.1875
4
from math import * print(2) # parenthesis for order of operation print(3 * (4 + 5)) # division print(3/1) # modulus operator print(10 % 3) # numbers inside variables my_num = 5 print(20 % my_num) # convert number to string (you need to do this to concatenate strings and numbers) my_num = 6 print("I have " + str(m...
true
88acce823bf11faaf330eccb89f8a8e0f66fbbfa
Areeba-Seher04/Python-OOP
/2 INHERITANCE/2 Inheritance.py
1,036
4.28125
4
#class Person(object): class Person: #Parent class def __init__(self,name,age): self.name = name self.age = age def get_name(self): return self.name def get_age(self): return self.age class Employee(Person): #Child class ''' **Ch...
true
ec1451e3c75e5c1726a49298cc43beaee0ab23a8
Areeba-Seher04/Python-OOP
/3 FUNCTIONS arg,kwarg/3.arg in function call.py
421
4.28125
4
#ARG IN FUNCTION CALL #We can also use *args and **kwargs to pass arguments into functions. def some_args(arg_1, arg_2, arg_3): print("arg_1:", arg_1) print("arg_2:", arg_2) print("arg_3:", arg_3) args = ("Sammy", "Casey", "Alex") #args is a tuple some_args(*args) #pass all arguments in a function args...
true
f495dd4e59b615d52f4ecc260c5075466f2c1f8a
UrduVA/Learn-Python
/while_Infi.py
206
4.1875
4
x = 0 while x != 5: print(x) x = int(input("Enter a value or 5 to quit: ")) ##0 ##Enter a value or 5 to quit: 1 ##1 ##Enter a value or 5 to quit: 2 ##2 ##Enter a value or 5 to quit: 5
true
8d6bcffee5cdace0ddc5e79be117999ad094c349
hanchettbm/Pythonprograms
/Lab12 updated.py
2,590
4.4375
4
# 1. Name: # -Baden Hanchett- # 2. Assignment Name: # Lab 12: Prime Numbers # 3. Assignment Description: # -This program will display all the prime numbers at # or below a value given by the user. It will prompt the # user for an integer. If the integer is less than 2, # then the pro...
true
20290067dda6e0cc8d3d4661ecaaa73428186d19
guozhaoxin/mygame
/common/common.py
2,043
4.21875
4
#encoding:utf8 __author__ = 'gold' # import win32api,win32con import tkinter as tk from tkinter import filedialog,messagebox import pygame import sys def chooseFile(): ''' this method is used to let the player choose a file to continue a saved game :return: str,represent a file's absolute path the player...
true
c856254295dfe0dfe2e8cd40554bf127a8dfef32
UAL-AED/lab5
/aed_ds/queues/adt_queue.py
745
4.375
4
from abc import ABC, abstractmethod class Queue(ABC): @abstractmethod def is_empty(self) -> bool: ''' Returns true iff the queue contains no elements. ''' @abstractmethod def is_full(self) -> bool: ''' Returns true iff the queue cannot contain more elements. ''' @abstractmethod ...
true
6f26cbdbc4352a6a01f735f41ede7dcd3cf847e8
lewie14/lists_sorting
/lists2.py
2,684
4.28125
4
list1 = range(2, 20, 2) #Find length of list1 list1_len = len(list1) print(list1_len) #Change the list range so it skips 3 instead of 2 numbers list1 = range(2, 20, 3) #Find length of list1 list1_len = len(list1) print(list1_len) print() #------------------------------------------------------ #indexes employees =...
true
5feadeba85d180dca1c7a7f0445a32692dc3b9c6
MichaelrMentele/LearnPythonTheHardWay
/ex18.py
566
4.25
4
def print_two(*args): arg1, arg2 = args print "arg1: %r, arg2: %r" % (arg1, arg2) def print_two_again(arg1, arg2): print "arg1: %r, arg2: %r" % (arg1, arg2) def print_one(arg1): print "arg1: %r" % arg1 def print_none(): print "I got nothin'." print_two("Zed","Shaw") print_two_again("Zed","Shaw") print_one("Fir...
true
2d0c41f4f1e73659d39f318038f6bf7344d66112
durgeshiv/py-basic-scripting-learning
/com/durgesh/software/slicing.py
768
4.21875
4
x='LetsSliceThisString' # we have defined a string as above, lets try to slice it and print 'ThisString' # [] -> is the syntax for slicing # slicedString = x[9:] # Here, this starts at index 9 and : means we haven't specified end # index thus everything until end would be taken print(slicedString) # give o/p as 'Thi...
true
a3bd72a4f86653946331505e4b8157675cc3e153
irskep/mrjob_course
/solutions/wfc_job.py
1,293
4.125
4
""" Write a job that calculates the number of occurrences of individual words in the input text. The job should output one key/value pair per word where the key is the word and the value is the number of occurrences. """ from collections import Counter, defaultdict from mrjob.job import MRJob class MRWordFrequencyCou...
true
98815d02b2b32a065ef7daf466ee5e503e4aed62
meghasn/py4_everyone_solution
/question9.py
255
4.34375
4
#using a while loop read from last character of a string and print backwards word=input("enter the string:") index=len(word)-1 while index>=0: a=word[index] print(a) index=index-1 #enter the string:banana #a #n #a #n #a #b
true
8020336c54f223edc92891c3689c880483e6085f
wingateep/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
894
4.28125
4
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): # TBC #base case count = 0 # sets ...
true
9cc9fa08a66e0d79b46790ed5232c66f934933f0
rachelmccormack/PythonRevision-Tutoring
/Homework/Solutions/furtherFileReading.py
875
4.15625
4
""" A list of words is given in a file words.txt For this file, please give the number of times each word appears, in the form {word:number} Please display the longest word How many words are in the list? (Don't peek) What percentage of the words are unique? """ file = open("words.txt") words = file.readlines() file.c...
true
ac0792f282322dc080a62a79f83b57aad55a4d38
rachelmccormack/PythonRevision-Tutoring
/Homework/shoppinglist.py
795
4.21875
4
# Fill out Shopping List Program print("Welcome to the shopping list program...") shoppingList = [] finalise = False def finaliseList(): print("Your final list is: ") for item in shoppingList: print(item) print("Thank you!") return True """ Here we need functions for adding to the li...
true
0d68551843d403dfe1ba8f923220c70937532eb0
paradoxal/3.-linkedlist
/linkedlist MALLI.py
2,810
4.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ :File: linkedlist.py :Author: <Your email> :Date: <The date> """ class LinkedList: """ A doubly linked list object class. The implementation makes use of a `ListNode` class that is used to store the references from each node to its predecessor and follower ...
true
81fe36735b80677a69cd5f1b229ba777cb0dcdf9
santosh-srm/srm-pylearn
/28_max_of_three_numbers.py
917
4.40625
4
"""28_max_of_three_numbers.py""" print("----Finding max of 3 numbers----") num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) num3 = int(input("Enter the third number: ")) if (num1 > num2): if (num1 > num3): print(f'The max number is {num1}') else: pr...
true
8a8b90655fc27a1434364c3581fdb48792f07658
dlenwell/interview-prep-notes
/code-samples/python/inverting_trees/invert.py
1,913
4.25
4
""" Tree inversion: """ from tree import Node, Tree from collections import deque class InvertTree(Tree): """ InvertTree Tree class extends the base Tree class and just adds the invert functions. This class includes a recursive and an iterative version of the function. """ def invert_aux(s...
true
3110b65f4b971f4a2c2967f250e3a22afd73e8f0
ajerit/python-projects
/sorting/binary.py
451
4.15625
4
# # Adolfo Jeritson # Binary search implementation # 2016 # # inputs: A: Array of elements # x: Target element # returns None if the element is not found # the position in the array if the element is found def binarySearch(A, x): start = 0 end = len(A) while start < end: mid = end + (start-end) ...
true
ea30d850e5f06ac21da9ef24a9f1e4d6cade3401
Anupama-Regi/python_lab
/24-color1_not_in_color2.py
235
4.1875
4
print("Program that prints out all colors from color-list1 not contained in color-list2") l=input("Enter list1 of colors : ") l2=input("Enter list2 of colors : ") a=l.split() b=l2.split() l3=[i for i in a if i not in b] print(l3)
true
674392160a40f2309d6542271f2325d25bd5abc8
Anupama-Regi/python_lab
/28-remove_even_numbers.py
315
4.21875
4
print("*Program to create a list removing even numbers from a list of integers.*") n=input("Enter the list of integers : ") l=list(map(int,n.split())) print("List of numbers : ",l) #l2=[i for i in l if i%2!=0] #print(l2) for i in l: if(i%2==0): l.remove(i) print("List after removing even numbers : ",l)
true
7f902eb622852e3435c85d96ab00338b215a3f1e
Anupama-Regi/python_lab
/Cycle_3-python-Anupama_Regi/15-factorial_using_function.py
209
4.4375
4
print("Program to find factorial using function") def factorial(n): f=1 for i in range(1,n+1): f=f*i print("Factorial is ",f) n=int(input("Enter the number to find factorial : ")) factorial(n)
true
3bf050700ee59e70d6fa1b5f41b4829a1b033df9
horia94ro/python_fdm_26februarie
/day_2_part_1.py
1,981
4.25
4
print(7 >= 10) print(10 != 12) print(15 > 10) a = 32 if (a >= 25 and a <= 30): print("Number in the interval") else: if (a < 25): print("Number is smaller than 25") else: print("Number is bigger than 30") if a >= 25 and a <= 30: print("Number in the interval") elif a < 25: print...
true
ac3ef1b204dc2e5be36f08d323737db025865c55
Woodforfood/learn_how_to_code
/Codewars/7kyu/Find_the_capitals.py
260
4.125
4
# Write a function that takes a single string (word) as argument. # The function must return an ordered list containing the indexes of all capital letters in the string. def capitals(word): return [i for i, letter in enumerate(word) if letter.isupper()]
true
7a63e23ebafcc8275fa1307cfa41aa79050538ba
aslishemesh/Exercises
/exercise1.py
692
4.125
4
# Exercise1 - training. def check_div_even(num, check): if num % check == 0: return True else: return False num = input("Please enter a number: ") if check_div_even(num, 4): print "The number %d can be divided by 4" % num elif check_div_even(num, 2): print "The number %d is an e...
true
9f1157b501791c4cac209b2ebacefaf0c04da0aa
benfield97/info-validator
/info_validator.py
1,041
4.1875
4
import pyinputplus as pyip import datetime import re while True: name = pyip.inputStr("What is your name? ") if all(x.isalpha() or x.isspace() for x in name): name_len = name.split() if len(name_len) < 2: print("Please enter both a first and last name") continue ...
true
a4e828ffddc57348328a53dae0208e7be7044902
nerdycheetah/lessons
/recursion_practice.py
339
4.28125
4
''' Recursion Practice 10/17/2020 Example: Let's make a function that takes in a number and recursively adds to the total until the number reaches 1 ''' def recursive_total(n:int) -> int: if n == 1: return n else: print(f'n is currently: {n}') return recursive_total(n - 1) + n print(r...
true
edcab377fe47ccda40631e5c4a906446972c0ca3
nicowjy/practice
/Leetcode/101对称二叉树.py
753
4.15625
4
#!/usr/bin/python # -*- coding: utf-8 -*- # 对称二叉树 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isSymmetric(self, root): """ :type root: TreeNode ...
true
1daf2db78044c8a1fcd44d918f5156a06ea9c75d
KartikKannapur/Algorithms
/00_Code/01_LeetCode/559_MaximumDepthofN-aryTree.py
1,385
4.25
4
""" Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. For example, given a 3-ary tree: We should return its max depth, which is 3. """ """ # Definition for a Node. class Node(object): def __init__(se...
true
b4f0f0a2746fe03ceebd1007794f815f4d5c36a1
KartikKannapur/Algorithms
/00_Code/01_LeetCode/557_ReverseWordsinaStringIII.py
704
4.21875
4
# #Given a string, you need to reverse the order of characters # #in each word within a sentence while still preserving whitespace # #and initial word order. # #Example 1: # #Input: "Let's take LeetCode contest" # #Output: "s'teL ekat edoCteeL tsetnoc" # #Note: In the string, each word is separated by single space and ...
true
2f883b3bd4645908e4b77ed0ae0669be10e283be
KartikKannapur/Algorithms
/00_Code/01_LeetCode/876_MiddleoftheLinkedList.py
1,440
4.1875
4
""" Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3. (The judge's serialization of this n...
true
7b60b68b7fb1f6e0f71f016fee6c1a5fa25289a3
KartikKannapur/Algorithms
/00_Code/01_LeetCode/239_SlidingWindowMaximum.py
1,155
4.28125
4
""" Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. Example: Input: nums = [1,3,-1,-3,5,3,6,7], and k = 3 O...
true
cd1d5ae088fc786391b2a0ff3c27dd874420d13f
KartikKannapur/Algorithms
/00_Code/01_LeetCode/332_ReconstructItinerary.py
1,832
4.5625
5
""" Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK. Note: If there are multiple valid itineraries, you should return the itinerary th...
true
0a1b65a184da3df85610fbe3760ae972c2834db1
KartikKannapur/Algorithms
/00_Code/01_LeetCode/883_ProjectionAreaof3DShapes.py
2,987
4.5
4
""" On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j). Now we view the projection of these cubes onto the xy, yz, and zx planes. A projection is like a shadow, that maps our 3 dimen...
true
24ea31762444a62ad6d997c484bf624da5cdd2a5
KartikKannapur/Algorithms
/02_Coursera_Algorithmic_Toolbox/Week_01_MaximumPairwiseProduct.py
991
4.1875
4
# Uses python3 __author__ = "Kartik Kannapur" # #Import Libraries import sys # #Algorithm: # #Essentially we need to pick the 2 largest elements from the array # #Method 1: Sort the array and select the two largest elements - Very expensive # #Method 2: Scan the entire array twice by maintaining two indexes - Max1 an...
true
950e019702f534105369ef8d70380546c910e1dc
testmywork77/WorkspaceAbhi
/Year 8/Casting.py
812
4.28125
4
name = "Bruce" age = "42" height = 1.86 highscore = 128 # For this activity you will need to use casting as appropriate. # Using the data stored in the above variables: # 1. Use concatenation to output the sentence - "Bruce is 1.86m tall." print(name + " is " + str(1.86) + "m tall.") # 2. Use concatenation to output th...
true