blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
032e58342dd4dd263ae96aabb6563dad78d68b15
vinayakentc/BridgeLabz
/DataStructProg/Palindrome_Checker.py
1,363
4.46875
4
# Palindrome­Checker # a. Desc ­> A palindrome is a string that reads the same forward and backward, for # example, radar, toot, and madam. We would like to construct an algorithm to # input a string of characters and check whether it is a palindrome. # b. I/P ­> Take a String as an Input # c. Logic ­> The solution to ...
true
25fab75d27473ef6b0949ddcbb0a2678eefbf108
vinayakentc/BridgeLabz
/FunctionalProg/Factors.py
1,012
4.21875
4
# 6. Factors # a. Desc ­> Computes the prime factorization of N using brute force. # b. I/P ­> Number to find the prime factors # c. Logic ­> Traverse till i*i <= N instead of i <= N for efficiency . # d. O/P ­> Print the prime factors of number N # ----------------------------------------------------------------------...
true
8475bd109f4efb302b35f5d16ef5aaf358d43ad6
vinayakentc/BridgeLabz
/DataStructProg/UnOrderedList.py
1,985
4.28125
4
# UnOrdered List # a. Desc ­> Read the Text from a file, split it into words and arrange it as Linked List. # Take a user input to search a Word in the List. If the Word is not found then add it # to the list, and if it found then remove the word from the List. In the end save the # list into a file # b. I/P ­> Read fr...
true
43571e37ad1874a2fae40dda3072bf32b5a7129c
acse-yq3018/CMEECourseWork
/Week2/Code/lc1.py
1,521
4.21875
4
#!/usr/bin/env python3 """Use list comprehension and loops to extract target data""" __appname__ = 'lc1.py' __author__ = 'Yuxin Qin (yq3018@imperial.ac.uk)' __version__ = '0.0.1' ################################################################### birds = ( ('Passerculus sandwichensis','Savannah sparrow',18.7), ...
false
ecdab4779ef50d91930195f0e2199b8314b8ee47
josephhyatt/python_snippets
/check_for_greatest_of_3_numbers.py
405
4.1875
4
user_input_0 = int(input("Insert 1st number: ")) user_input_1 = int(input("Insert 2nd number: ")) user_input_2 = int(input("Insert 3rd number: ")) print("The biggest number is: ", end="") if user_input_1 <= user_input_0 >= user_input_2: print(user_input_0) elif user_input_0 <= user_input_1 >= user_input_2: print(u...
false
7d46a845ad0bed2298511f782e37faee1f7701ac
afurkanyegin/Python
/The Art of Doing Code 40 Challenging Python Programs Today/2-MPH to MPS Conversion App.py
262
4.15625
4
print("Welcome to the MPH to MPS Conversion App") speed_in_miles=float(input("What is your speed in miles:")) speed_in_meters=speed_in_miles * 0.4474 rounded_speed_in_meters=round(speed_in_meters,2) print(f"Your speed in MPS is: {rounded_speed_in_meters}")
true
23a71da2a35150b6dd70cc4f5507cce6c37b87a6
TonyVH/Python-Programming
/Chapter 02/Calculator.py
541
4.25
4
# Calculator.py # This is a simple, interactive calulator program def calculator(): print('Calculator guide:') print('Use + to add') print('Use - to subtract') print('Use * to multiply') print('Use / to divide') print('Use ** for exponentials') print('Use // for floor division') print('U...
true
0c7a6dc53b0e75076918ef422b5cf3da28b052a1
TonyVH/Python-Programming
/Chapter 05/acronym.py
330
4.34375
4
# acronym.py # Program to create an acronym from a user given sentence/phrase def main(): print('This program will create an acronym from a word or phrase\n') phrase = input('Enter a sentence or phrase: ') phrase = phrase.split() for words in phrase: print(words[0].upper(), end='') print(...
true
433a50201f6701711216a57bd7839d86ca667331
zhangweisgithub/demo
/python_basic/其他/range的参数.py
508
4.25
4
# !/usr/bin/env python # -*- coding: utf-8 -*- # range(start, stop[, step]) print(list(range(5))) # [0, 1, 2, 3, 4] 默认是0-4 print(list(range(0, 5))) # [0, 1, 2, 3, 4] print(list(range(1, 7))) # [1, 2, 3, 4, 5, 6] print(list(range(3, 20, 3))) # [3, 6, 9, 12, 15, 18] 第三个参数代表的是step print(list(range(10, 0, -1)))...
false
a5e07f98fb6d18fc88a88495e1aadb105b7fb5a5
zhangweisgithub/demo
/algorithm/冒泡排序.py
1,468
4.1875
4
# !/usr/bin/env python # -*- coding: utf-8 -*- """ 基本思想: 冒泡排序,类似于水中冒泡,较大的数沉下去,较小的数慢慢冒起来,假设从小到大,即为较大的数慢慢往后排,较小的数慢慢往前排。 直观表达,每一趟遍历,将一个最大的数移到序列末 冒泡排序的时间复杂度是O(N^2) 冒泡排序的思想: 每次比较两个相邻的元素, 如果他们的顺序错误就把他们交换位置 冒泡排序原理: 每一趟只能将一个数归位, 如果有n个数进行排序,只需将n-1个数归位, 也就是说要进行n-1趟操作(已经归位的数不用再比较) 缺点: 冒泡排序解决了桶排序浪费空间的问题, 但是冒泡排序的效率特别低 """ def bu...
false
1bcd526e6e0efd5c566f629a2d4945e2c41b759b
Yurcik45/python-train
/pynative_exercises/2.py
264
4.34375
4
#2 Отображение трех строк «Name», «Is», «James» как «Name ** Is ** James» string_1 = "Name" string_2 = "Is" string_3 = "James" print(string_1 + "**" + string_2 + "**" + string_3) # or print(string_1, string_2, string_3, sep="**")
false
a0ee9db42b6a9cc7f4a423e2281a718a1789981f
DeepeshYadav/AutomationMarch2020
/PythonPractice/Lambda_function/practice/Decorator Introdcution.py
740
4.3125
4
""" Decorators 1. Need to take a function as parameters 2. Add Functionality to the function. 3. Function need to return another function. -> In general language a decorator means , the person who does decoration job. to make things more presentable. for examples i want to given gift to my friend like watch 1 -> I ...
true
cde40dccf5ea9938c8572de56bb6de3a9f8d131e
DeepeshYadav/AutomationMarch2020
/PythonPractice/Decorators/property_decor_example1.py
544
4.28125
4
# In this class will how to set values using setter # and next example2 will explain how achieve this using @propert decorator class Student: def __init__(self, name, grade): self.name = name self.grade = grade def msg(self): return self.name +" got the grade "+self.grade def set...
true
0248a047a97752eb6028adf81022ad57b765e5e2
ahmed-t-7/Programming-Foundations-Fundamentals
/3. Variables and Data Types/Challenge_What_is_The_output.py
496
4.40625
4
print("Challenge 1:") # A message for the user message = "This is going to be tricky ;)" Message = "Very tricky!" print(message) # show the message on the screen this statement will print the first message variable # Perform mathematical operations result = 2**3 print("2**3 =", result) result = 5 - 3 #Change the v...
true
8bcdc627379f686bbc937d6c6c756cadd1d9cc75
JeffreyAsuncion/Study-Guides
/Unit_3_Sprint_2/study_part1.py
2,472
4.28125
4
import os import sqlite3 """ ## Starting From Scratch Create a file named `study_part1.py` and complete the exercise below. The only library you should need to import is `sqlite3`. Don't forget to be PEP8 compliant! 1. Create a new database file call `study_part1.sqlite3` """ DB_FILEPATH = os.path.join(os.path.dirna...
true
223b6e68740e9411f390b37869df3125c8fe49c0
usamarabbani/Algorithms
/squareRoot.py
996
4.15625
4
'''take user input number = int(input("Enter a number to find the square root : ")) #end case where user enter less than 0 number if number < 0 : print("Please enter a valid number.") else : sq_root = number ** 0.5 print("Square root of {} is {} ".format(number,sq_root))''' def floorSqrt(x): # Base cases ...
true
f3e397a744558c935850f18001b4a5bf14e56ec6
usamarabbani/Algorithms
/mergeTwoSortedList.py
2,189
4.46875
4
# Defining class which will create nodes for our linked lists class Node: def __init__(self, data): self.data = data self.next = None # Defining class which will create our linked list and also defining some methods class LinkedList: def __init__(self): self.head = None def printLi...
true
970f23ef1afa5d5c2ae538b25c9c9fbc191745f9
BigThighDude/SNS
/Week3/Ch5_Ex2.py
1,133
4.34375
4
num = int(input("Enter integer to perform factorial operation:\n")) #prompt user to enter number, converts string to interger. program doesnt work if float is entered def fact_iter(num): #define iterative function product = 1 # define product before it is used for i in range(1,num+1): #count up from 1 (w...
true
59367641bfd30e48e5d18b80b386a518d30b627a
waltermblair/CSCI-220
/hydrocarbon.py
263
4.125
4
print("This program calculates the molecular weight of a hydrocarbon") h=eval(input("How many hydrogen atoms?")) c=eval(input("How many carbon atoms?")) o=eval(input("How many oxygen atoms?")) w=h*1.0079+c*12.011+o*15.9994 print("The weight is ",w," grams/mole")
false
dce29aacbef5e86574b300659dd52c9edb4868f5
waltermblair/CSCI-220
/random_walk.py
723
4.28125
4
from random import randrange def printIntro(): print("This program calculates your random walk of n steps.") def getInput(): n=eval(input("How many steps will you take? ")) return n def simulate(n): x=0 y=0 for i in range(n): direction=randrange(1,5) if direction==1: ...
true
ddb747b2b03438b099c0cf14b7320473be16888b
waltermblair/CSCI-220
/word_count_batch.py
404
4.28125
4
print("This program counts the number of words in your file") myfileName=input("Type your stupid ass file name below\n") myfile=open(myfileName,"r") mystring=myfile.read() mylist=mystring.split() word_count=len(mylist) char_count=len(mystring) line_count=mystring.count("\n") print("Words: {0}".format(word_count))...
true
28f61625f6cc35e07557140465f6b2dcc3974d77
delgadoL7489/cti110
/P4LAB1_LeoDelgado.py
549
4.21875
4
#I have to draw a square and a triangle #09/24/13 #CTI-110 P4T1a-Shapes #Leonardo Delgado # #import the turtle import turtle #Specify the shape square = turtle.Turtle() #Draws the shape for draw in range(4): square.forward(100) square.right(90) #Specify the shape triangle = turtle.Turtle()...
true
714c9c402b65cf3102425a3467c1561eaa20f2dd
delgadoL7489/cti110
/P3HW2_Shipping_LeoDelgado.py
532
4.15625
4
#CTI-110 #P3HW2-Shipping Charges #Leonardo Delgado #09/18/18 # #Asks user to input weight of package weight = int(input('Enter the weight of the package: ')) if weight <= 2: print('It is $1.50 per pound') if 2 < weight <=6: print('It is $3.00 per pound') if 6 < weight <=10: print('It is $4.0...
true
05be92d0a985f8b51e2478d52d0d476539b1f96c
delgadoL7489/cti110
/P5T1_KilometersConverter_LeoDelgado.py
659
4.59375
5
#Prompts user to enter distance in kilmoters and outputs it in miles #09/30/18 #CTI-110 P5T1_KilometerConverter #Leonardo Delgado # #Get the number to multiply by Conversion_Factor = 0.6214 #Start the main funtion def main(): #Get the distance in kilometers kilometers = float(input('Enter a distan...
true
b97e8694dd80c4207d2aef3db11326bef494c1d5
aju22/Assignments-2021
/Week1/run.py
602
4.15625
4
## This is the most simplest assignment where in you are asked to solve ## the folowing problems, you may use the internet ''' Problem - 0 Print the odd values in the given array ''' arr = [5,99,36,54,88] ## Code Here print(list(i for i in arr if not i % 2 ==0)) ''' Problem - 1 Print all the prime numbers from 0-100 ...
true
c487f10008953853ffce904974c01f60be0e9874
justus-migosi/desktop
/database/queries.py
1,179
4.40625
4
import sqlite3 from sqlite3 import Error # Create a connection def create_connection(file_path): """ Creates a database connection to the SQLite database specified by the 'path'. Parameters: - path - Provide path to a database file. A new database is created where non exists. Return: - Retu...
true
0acadc79127f5cc53cb616bac3e31c2ef120822f
shahzadhaider7/python-basics
/17 ranges.py
926
4.71875
5
# Ranges - range() range1 = range(10) # a range from 0 to 10, but not including 10 type(range1) # type = range range1 # this will only print starting and last element of range print(range1) # this will also print same, starting and last element list(range1) # this will list the whole range from...
true
69f33f4919562b4dd54d868fbc63c81ecf4567ca
youssefibrahim/Programming-Questions
/Is Anagram.py
725
4.15625
4
#Write a method to decide if two strings are anagrams or not from collections import defaultdict def is_anagram(word_one, word_two): size_one = len(word_one) size_two = len(word_two) # First check if both strings hold same size if size_one != size_two: return False dict_chars = defaultdict(int) # Use di...
true
65778e41f5d2fae0c62993edd0c98ca8c603783d
EXCurryBar/108-2_Python-class
/GuessNumber.py
374
4.125
4
import random number = random.randint(0,100) print(number) print("Guess a magic number between 0 to 100") guess = -1 while guess != number : guess = eval(input("Enter your guess: ")) if guess == number : print("Yes, the number is ",number) elif guess > number : print("Your guess is too high...
true
24c61c19c87c1dfe990ace7a4640a17328add3b0
PaulSweeney89/CTA-Quiz
/factorial.py
322
4.15625
4
# Recursive Algorithms - Lecture 06 # Computing a factorial # Iterative Implementation def factorial(n): answer = 1 while n > 1: answer *= n n -= 1 return answer print(factorial(5)) # Recursive Implementation def factorial_rec(n): if n <= 1: return 1 else: return n*factorial_rec(n-1) print(factorial(5...
false
112da84fe029bfec6674f8fdf8cea87da361a96f
tminhduc2811/DSnA
/DataStructures/doubly-linked-list.py
2,053
4.3125
4
""" * Singly linked list is more suitable when we have limited memory and searching for elements is not our priority * When the limitation of memory is not our issue, and insertion, deletion task doesn't happend frequently """ class Node(): def __init__(self, data): self.data = data self.nex...
true
2d0e92702fd53f816265742c6f025e2b8b39e181
tminhduc2811/DSnA
/Algorithms/binary_search.py
703
4.3125
4
import merge_sort def binary_search(arr, start, end, x): # T(n/2) => O(lg(n)) if start <= end: middle = (start + end)//2 if arr[middle] == x: return middle if arr[middle] > x: return binary_search(arr, start, middle - 1, x) if arr[middle] < x: ret...
false
bf3bf0b5546410fa191c261b24ec632e761ff151
nayana09/python
/file1.py
2,555
4.125
4
#!/usr/bin/env python # coding: utf-8 # In[1]: print("Hello, Welcome to python Introduction") # In[2]: #Python Variables x = 5 y = "Nayana" print(x) print(y) # In[7]: x = 4 x = "Grapes" print(x) # In[4]: #casting x = str(3) y = int(3) z = float(3) print(x) print(y) print(z) # In[6]: #get data type x...
false
4e60800182b8bb8fccbb924b21ebc40cdfb497b5
jessiicacmoore/python-reinforcement-exercises
/python_fundamentals1/exercise5.py
319
4.125
4
distance_traveled = 0 while distance_traveled >= 0: print("Do you want to walk or run?") travel_mode = input() if travel_mode.lower() == "walk": distance_traveled += 1 elif travel_mode.lower() == "run": distance_traveled += 5 print("Distance from home is {}km.".format(distance_traveled))
true
6760a6c8331365ef174c58d2b742b3ffd407807c
jessiicacmoore/python-reinforcement-exercises
/python_fundamentals2/exercise6.py
218
4.25
4
def temperature_converter(f): c = (f-32)*5/9 print(f"{f} degrees fahrenheit is {c} degrees celsius!") print("Enter a temperature to convert from fahrenheit to celsius:") f = int(input()) temperature_converter(f)
false
32c4cc3778f9713a09d237cdb6024a7ec4fca5f2
chantigit/pythonbatch1_june2021data
/Python_9to10_June21Apps/project1/dictapps/ex1.py
534
4.25
4
#1.Creating empty dict a={} b=dict() #2.Creating dict with key,value c={'id':21,'name':'Ajay','height':5.6,'age':21,'name':'Arun'} print(type(a),type(b),type(c)) print(c) #3.Accessing dict values based on keys print(c['id']) print(c['name']) print(c['age']) print(c['height']) #4.Updating the dict c['height']=6.9 c['age...
false
bcc2045e953975bbdf2d78dc2888346072a0af24
chantigit/pythonbatch1_june2021data
/Python_9to10_June21Apps/project1/listapps/ex5.py
407
4.3125
4
#II.Reading list elements from console list1=list() size=int(input('Enter size of list:')) for i in range(size): list1.append(int(input('Enter an element:'))) print('List elements are:',list1) print('Iterating elements using for loop (index based accessing)') for i in range(size): print(list1[i]) print('Iterat...
true
7ccc459d2ab9e420b47bfefd00e04dddff87fa8a
NSO2008/Python-Projects
/Printing to the terminal/HelloWorld.py
584
4.21875
4
#This is a comment, it will not print... #This says Hello World... print('Hello World') #This is another example... print("This uses double quotes") #Quotes are characters while quotation is the use quotes... print("""This uses triple quotation... it will be displayed however I type it""") #This is an exampe of...
true
0b8f08d1f44d32eac328848be344c8d5e7cca3ad
cbolles/auto_typing
/auto_type/main.py
2,162
4.125
4
""" A tool that simulates keypresses based on a given input file. The program works by accepting a source file containing the text and an optional delimeter for how to split up the text. The program then creates an array of string based on the delimeter. Once the user presses the ESCAPE key, each value in the array wil...
true
3aa1d42dbbe55beadaeafe334950694fa9ece8f2
mickeyla/gwc
/Test A/test.py
596
4.125
4
#Comments are not for the code #Comments are for you #Or whoever answer1 = input ("What is your name?") print ("My name is", answer1) answer2 = input ("How old are you?") print ("I am", answer2, "years old!") answer3 = input ("Where are you from?") print ("I am from", answer3) answer4 = input ("Do you like coding?"...
true
cc8bf4379d575d1d414c7fd61e236c3d4d904b12
hauqxngo/PythonSyntax
/words.py
1,385
4.75
5
# 1. For a list of words, print out each word on a separate line, but in all uppercase. How can you change a word to uppercase? Ask Python for help on what you can do with strings! # 2. Turn that into a function, print_upper_words. Test it out. (Don’t forget to add a docstring to your function!) def print_upper_w...
true
9fe09a75083d05a172e61ce01faf3ab5d0e3e638
JoySnow/Algorithm
/tree/basic.py
1,253
4.3125
4
import Queue # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None def make_a_basic_n_level_tree(n): """ :type n: int :rtype: TreeNode """ if n <= 0: return None root = TreeNode...
false
be8fc7374858e1eb60bf2c3d3f82e7d351eb67eb
rorschachwhy/mystuff
/learn-python-the-hard-way/ex11_提问.py
502
4.1875
4
#ϰ11 print "How old are you?" age = raw_input() #עʾ䣬printһšԲỻ #6'2"鿴you're '6\'2"'tall print "How tall are you?", #һֵ䣬ѡšҲֵheightIJе˼ height = raw_input(), print "How much do you weight?" weight = raw_input() print "So, you're %r old, %r tall and %r heavy." % ( age, height, weight)
false
f318ba10d7384cec391620866cf1dbaa4d533e1e
rorschachwhy/mystuff
/learn-python-the-hard-way/ex7_10.py
2,062
4.40625
4
#ϰ7ӡ print "Mary had a little lamb." print "Its fleece was white as %s." % 'snow' print "And everywhere that Mary went." #ӡ10 print "." * 10 end1 = 'C' end2 = 'h' end3 = 'e' end4 = 'e' end5 = 's' end6 = 'e' end7 = 'B' end8 = 'u' end9 = 'r' end10 = 'g' end11 = 'e' end12 = 'r' #עⶺţcomma÷űʾո print end1 + end2 + end3 ...
false
b9aca14147a83020a98c423326da53267a25e8f2
Alexandra0102/python_basic_11_05_20
/env/les1_hw_6.py
1,244
4.25
4
"""6. Спортсмен занимается ежедневными пробежками. В первый день его результат составил a километров. Каждый день спортсмен увеличивал результат на 10 % относительно предыдущего. Требуется определить номер дня, на который общий результат спортсмена составить не менее b км. Программа должна принимать значения параметров...
false
1f52ebb74b762dcce6213360939086acb0b59f46
getconnected2010/testing123
/adventure story.py
1,194
4.1875
4
name = input('What is your name?:') print(f'Hello {name.capitalize()}, you are about to go on an adventure. You enter a room and see two doors. One is red and the other blue.') door_input = input('which door do you choose?: ') if door_input == 'red': print('Red door leads you to the future. You have to help a s...
true
ad0f0a5db0b0ed49f0424fc474b802fa0d374581
josemariasosa/jomtools
/python/classes/exercises/person-list.py
368
4.15625
4
#!/usr/bin/env python # coding=utf-8 """ EN: ES: """ # ------------------------------------------------------------------------------ class A(object): """Definiendo la clases A""" def __init__(self, cantidad): self.cantidad = cantidad a = A(10) print(a.cantidad) # -------------------------------...
false
cd7793038854eab3c67e631d3c158f2f00e9ad70
gauravraul/Competitive-Coding
/lcm.py
485
4.15625
4
# Program to get the lcm of two numbers def lcm(x,y) : #take the greater number if x>y: greater = x else: greater = y #if greater is divisible by any of the inputs , greater is the lcm #else increment greater by one until it is divisible by both the inputs while(True)...
true
111497f1b16aaf63fbe66df46dfc1eb12b0e705e
migantoju/design-patterns
/structural/facade.py
1,225
4.3125
4
""" *Facade Pattern* Proporciona una interfaz unificada más simple a un sistema complejo. Proporciona una forma más sencilla de acceder a los métodos de los sistemas subyacentes al proporcionar un único punto de entrada. Oculta la complejidad de los sitemas y provee una interfaz al cliente con la cual puede acced...
false
4d8e97b7749d85b15f5e1f20e332332ddf8e2513
the07/Python
/Algorithms/vowel_reduce.py
425
4.21875
4
#take a word and remove all the vowels and capitalise the first word state_names = ['Alabama', 'California', 'Oklahoma', 'Florida'] vowels = ['a','e','i','o','u'] for state in state_names: state_list = list(state) for letter in state_list: if letter.lower() in vowels: state_list.remove(let...
false
ecf0d4117ad8aab226e9808899b922d720cb0294
2018JTM2248/assignment-8
/ps2.py
1,919
4.65625
5
#!/usr/bin/python3 ###### this is the second .py file ########### ####### write your code here ########## #function definition to rotate a string d elemets to right def rotate_right(array,d): r1=array[0:len(array)-d] # taking first n-d letters r2=array[len(array)-d:] # last d letters rotate = r2+r1 # r...
true
620f08c42f7787718afa05210bef6c49e5422dff
vikashvishnu1508/algo
/oldCodes/threeNumSort.py
588
4.21875
4
array = [1, 0, 0, -1, -1, 0, 1, 1] order = [0, 1, -1] result= [0, 0, 0, 1, 1, 1, -1, -1] def threeNumSort(array, order): first = 0 second = 0 third = len(array) - 1 for i in range(len(array)): if array[i] == order[0]: second += 1 elif array[i] == order[2]: third...
false
b71a8ef228748fe80c9696c057b4f6c459c13f49
vikashvishnu1508/algo
/Revision/Sorting/ThreeNumSort.py
521
4.15625
4
def threeNumSort(array, order): first = 0 second = 0 third = len(array) - 1 while second <= third: if array[second] == order[0]: array[first], array[second] = array[second], array[first] first += 1 second += 1 elif array[second] == order[2]: ...
true
4b56de005259fa36f89377a8f315b029ea6a0ef4
vikashvishnu1508/algo
/oldCodes/threeNumberSum.py
704
4.15625
4
def threeNumberSum(array, targetSum): # Write your code here. array.sort() result = [] for i in range(len(array) - 2): left = i + 1 right = len(array) - 1 while left < right: newSum = array[i] + array[left] + array[right] if newSum == targetSum: ...
false
fff30ad774cb793bd20a0832cf45a1855e75a263
kacifer/leetcode-python
/problems/problem232.py
2,563
4.34375
4
# https://leetcode.com/problems/implement-queue-using-stacks/ # # Implement the following operations of a queue using stacks. # # push(x) -- Push element x to the back of queue. # pop() -- Removes the element from in front of queue. # peek() -- Get the front element. # empty() -- Return whether the queue is empty. # Ex...
true
44bd4d30acfddb690556faaf26174f6a6faee6fe
Carvanlo/Python-Crash-Course
/Chapter 8/album.py
412
4.15625
4
def make_album(artist_name, album_title, track=''): """Return a dictionary of information of an album.""" album = {'artist': artist_name, 'title': album_title} if track: album['track'] = track return album album_1 = make_album('Adam Levine', 'Begin Again', 3) print(album_1) album_2 = make_album('Emma Stevens...
true
94d9bca02dd044b5574522ef5f3185f8223a74e0
kumk/python_code
/donuts.py
593
4.15625
4
#Strings Exercise 1: Donuts # # Given an int count of a number of donuts, return a string of the form 'Number # #of donuts: <count>', where <count> is the number passed in. However, if the # #count is 10 or more, then use the word 'many' instead of the actual count. # So #donuts(5) returns 'Number of donuts: 5' and don...
true
7b418a8b46b44fe6913f808024e6c2ba683885d2
loknath0502/python-programs
/28_local_global_variable.py
374
4.25
4
a=8 # global variable def n(): a=10 print("The local variable value is:",a) # local variable n() print("The global variable value is:",a) '''Note: The value of the global variable can be used by local function variable containing print . But the value of the local variable cannot be used by the gl...
true
db8502678f3b850ad743cc8464436efcc6e01b20
ryanfirst/NextGen
/problem_types_set2.py
799
4.15625
4
# first_num = input('enter first number') # second_num = input('enter second number') # third_num = input('enter third number') # print(int(first_num) * int(second_num)) # print(int(first_num) * int(second_num) / int(third_num)) # num = input('pick a number') # print(int(num) % 2 == 0) # money = input('how much money w...
true
2d7b0d2c2cca6e975e6d212ac961cfbd3773195e
Luciano-A-Vilete/Python_Codes
/BYU_codes/Vilete_009.py
1,865
4.25
4
#Python Code 009 #Starting: print('You buy a sea trip around the asia continent, but someday your trip is over … and you woke up on an isolated island, alone … ') print('When you look around, you see nothing and no one else with you … You see just 3 things:') #The GAME: print('The items that you see are: \n1. ...
false
09c8da67245a500ea982344061b5d25dbc1d0a58
olive/college-fund
/module-001/Ex1-automated.py
1,456
4.25
4
# 1*.1.1) Rewrite the following function so that instead of printing strings, # the strings are returned. Each print statement should correspond to # a newline character '\n' in the functiono's output. def bar_print(a, b, c): if a == b: print("1") elif b == c: print("2") ...
true
e1146f7a613892b9d79b70a5fdf218eafd812681
AjayKumar2916/python-challenges
/047-task.py
280
4.15625
4
''' Write a program which can filter() to make a list whose elements are even number between 1 and 20 (both included). Hints: Use filter() to filter elements of a list. Use lambda to define anonymous functions. ''' e = range(1, 21) a = filter(lambda x:x%2==0, e) print(list(a))
true
ed08b421996fab5b1db393c23496aff72939db24
svukosav/crm
/database.py
1,603
4.375
4
import sqlite3 db = sqlite3.connect("database") cursor = db.cursor() # cursor.execute("""DROP TABLE users""") if db: # Create a table cursor.execute("""CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT, phone TEXT, email TEXT unique, password TEXT)""") db.commit() name1 = 'Andres' phone1 = '3366858' email1 = '...
true
184de35590496bb68c5b206432a49f9b240d2a46
joe-bq/algorithms
/sortings/bubble/bubble_rampUp_lowToHighIter.py
702
4.375
4
####################### # File: # bubbleSort_rampUp_lowToHighIter.py # Author: # Administrator # Description: # this program will show you how to write the insertion sort with the Python code. ####################### import sys def bubble_rampUp(a): length = len(a) for i in range(length-1, -1,-1)...
false
8fcb7b82752f768c0f992df69857b9cde803f8d4
singhujjwal/python
/fastapi/things-async.py
695
4.625
5
#!/usr/bin/python3 # # # yield example # yield applies to the generators and is now used to do async programming as well. def test_yield(some_list): for i in some_list: if i%2 == 0: yield i # Normal list iterator mylist = [x*x for x in range(3)] for i in mylist: print (i) for i in mylis...
false
4dd828096a5eb69c493930c8381a4b0bb6e7f9ca
si20094536/Pyton-scripting-course-L1
/q4.py
673
4.375
4
## 4. Given a list of non-empty tuples, return a list sorted in increasing order by the last element in each tuple. ##e.g. [(1, 7), (1, 3), (3, 4, 5), (2, 2)] yields [(2, 2), (1, 3), (3, 4, 5), (1, 7)] ## Hint: use a custom key= function to extract the last element form each tuple. ##i. [(1, 3), (3, 2), (2, 1...
true
9acba907b818c3e591571dbadaf3bdb751b91d99
kishan-pj/python_lab_exercise_1
/pythonproject_lab2/temperature.py
323
4.5
4
# if temperature is greater than 30, it's a hot day other wise if it's less than 10; # it's a cold day;otherwise,it's neither hot nor cold. temperature=int(input("enter the number: ")) if temperature>30: print("it's hot day") elif temperature<10: print("it's cold day") else: print("it's neither hot nor col...
true
8d8fff8b1f4ac7d1e6b2e77857d855380769d878
kishan-pj/python_lab_exercise_1
/pythonproject_lab2/Qno.5positive_negative_zero.py
277
4.40625
4
# for given integer x print true if it is positive,print false if it is negative and print # zero if it is 0. x=int(input("enter the number: ")) if x>0: print("the number is positive ") elif x<0: print("the number is negative ") else: print("the number is zero ")
true
1d32702262eea6ddd58d869c713f7089361a5947
cwkarwisch/CS50-psets
/vigenere/vigenere.py
2,383
4.4375
4
import sys from cs50 import get_string def main(): # Test if the user has only input two strings (the name of the program and the keyword) if len(sys.argv) != 2: print("Usage: ./vigenere keyword") sys.exit(1) # Test if the keyword is strictly alphabetic if not sys.argv[1].isalpha(): ...
true
eb6b446a8af08b0593c2f8c63511193d0355285b
eMintyBoy/pyLabs
/Tanya/LR5/lr5_zad1.py
841
4.1875
4
# Дан одномерный массив, состоящий из N вещественных элементов. Ввести массив с клавиатуры. Найти и вывести минимальный по модулю элемент. Вывести массив на экран в обратном порядке. list = [] N = int(input("Введите количество элементов списка: ")) print("Введите элементы списка: ") for i in range(N): a = int(in...
false
ce6a09f9e1b13bc8456bb3410a58aa051e553b6d
JordanKeller/data_structures_and_algorithms_python
/climbing_stairs.py
489
4.21875
4
def climbing_stairs(n): """Input a positive integer n. Climb n steps, taking either a single stair or two stairs with each step. Output the distinct ways to climb to the top of the stairs.""" a = 1 b = 2 if n == 1: return a if n == 2: return b # n >= 3 for i in range(n - 2): c = a + b a = b b ...
true
bbdc9a562338830d393ffaa290329b92f730b274
manimaran1997/Python-Basics
/ch_08_OOP/Projects/ch_04_Inheritance/ex_inheritance.py
2,861
4.125
4
# coding: utf-8 # In[42]: class Employee: employeeCounter = 0; def __init__(self,firstName,lastName): self.firstName = firstName self.lastName = lastName Employee.employeeCounter += 1 print(" hello i employee") def displayEmployeeName(self): ...
true
1f2aecc0de33c798ece74a255b1eb8c10b6e2909
manimaran1997/Python-Basics
/ch_07_Data Structures in Python/ch_02_Sequence Types/ch_01_List/Project/01_Basics Of List/pythonList.py
1,658
4.1875
4
# coding: utf-8 # # 1.Create List # In[1]: #1.1 by brackets # In[2]: list1 = [1,2,3,4] # In[3]: print(list1) # In[4]: list2 = [1,2.5,3+5j,"ahmed"] # In[5]: print(list2) # In[6]: #1.2 By Constructor # In[7]: list3 = list((1,2,3,"hello world")) # In[8]: print(list3) # # 2.add Item # In[10]: l...
false
c380edaae8661d21363c2ea2fe90f59d3879306c
efitzpatrick/Tkinter
/firstRealExample.py
2,121
4.375
4
# www.tkdocs.com/tutorial/firstexample.html #tells python that we need the modlues tkinter and ttk # tkinter is the standard binding to Tk (what is a binding?) # ttk is Python's binding to the newer themed widgets that were added to 8.5 from tkinter import * from tkinter import ttk #calculate procedure def calculate(*...
true
f1d9667058f1fc7d1dfdf70c4bf7dad6bc195bf7
ManSleen/Graphs
/projects/ancestor/ancestor.py
2,980
4.15625
4
from collections import deque class Graph: """Represent a graph as a dictionary of vertices mapping labels to edges.""" def __init__(self): self.vertices = {} self.visited = set() def __repr__(self): for vertex in self.vertices: return f"{vertex}" def add_vertex(...
true
6635b9b2744114746ca1e5992162291bb8b9b946
sanjit961/Python-Code
/python/p_20_logical_operator.py
671
4.34375
4
#Logical Operator in Python: #If applicant has high income AND good credit #then he is eligible for loan # Logical and operator ----> both condition should be true # Logical or operator ----> at least one condition should be true. # Logica not operator ----> it converses the value True ---> False, False ---> Tru...
true
0ac6446ca514c2308ac7db5a1db3f8ca268d44c6
sanjit961/Python-Code
/python/p_13.Arithmetic_Operator.py
647
4.6875
5
#Arithmetic Operator in Python: print(10 - 3) #Subtraction print(10 + 4) #Addition print( 10 / 5) #Division print( 10 // 5) #This prints the Quotient with interger value only print( 10 % 3) #This % (Modulo Operator) prints the remainder print(10 * 5) #Mutltiplication operator * ("Asterisk") print(1...
true
f4c66c7312983e0e669251890946b7d68c65f4fb
MrCQuinn/Homework-2014-15
/CIS_211_CS_II/GUI turn in/flipper.py
1,146
4.40625
4
#Flippin' Cards program #By Charlie Quinn from tkinter import * from random import randint from CardLabel import * side = ["back","front","blank"] n = 0 a = 2 def flip(): """ Function that runs when "Flip" button is pressed. a is a value that starts at 0 and goes to 8 before going back to 0 w and n a...
true
c06e676609489425c5f00e15778a2acc831e37cf
Dvshah13/Machine-and-Deep-Learning-Code-Notes
/data_munging_basics-categorical.py
1,701
4.28125
4
## You'll be working often with categorical data. A plus point is the values are Booleans, they can be seen as the presence or absence of a feature or on the other side the probability of a feature having an exhibit (has displayed, has not displayed). Since many ML algos don't allow the input to be categorical, boole...
true
b4a49e0d08e0e8e0710f3014e2ccb28b6d9017e9
stevenfisher22/python-exercises
/Homework 14 Nov 2018/guess-a-number.py
1,645
4.125
4
# STEP 1: GUESS A NUMBER # secret_number = 2 # answer = 0 # while answer != secret_number: # answer = int(input('I\'m thinking of a number between 1 and 10. What\'s the number? ')) # if answer != secret_number: # print('Nope, try again ') # print('You win!') # STEP 2: GIVE A HIGH-LOW HINT # secret_n...
true
60d45067426464abb0f20b20a665dc3d6741b1a5
Mohan-Zhang-u/From_UofT
/csc148/pycharm/csc148/labs/lab5/nested.py
2,226
4.15625
4
def nested_max(obj): """Return the maximum item stored in <obj>. You may assume all the items are positive, and calling nested_max on an empty list returns 0. @type obj: int | list @rtype: int >>> nested_max(17) 17 >>> nested_max([1, 2, [1, 2, [3], 4, 5], 4]) 5 >>> nested_max(...
true
3f0b740dc0a0d881af1346b6064f498e84f5f984
servesh-chaturvedi/FunGames
/Rock, Paper, Scissors/Rock Paper Scissors.py
1,003
4.1875
4
import random import time options={1:"rock", 2:"paper", 3: "scissors"} #build list try: again="y" while(again == "y"): player=int(input("Enter:\n 1 for Rock\n 2 for Paper\n 3 for Scissors\n")) #take player input print("You entered:", options[player]) comp=random.randint (1,...
true
223608bba840a65ed2c953ede96c797f4ad9cd63
SiddhartLapsiwala/Software_Testing_Assign2
/TestTriangle.py
1,990
4.3125
4
# -*- coding: utf-8 -*- """ Updated Jan 21, 2018 The primary goal of this file is to demonstrate a simple unittest implementation @author: jrr @author: rk """ import unittest from Triangle import classifyTriangle # This code implements the unit test functionality # https://docs.python.org/3/library/unittest.html ha...
true
0bf34cfec95bf6ab35d4c1b80ec42ea73dfb61ef
RiikkaKokko/JAMK_ohjelmoinnin_perusteet
/examples/13-collections/set.py
1,047
4.28125
4
# declare set of names and print nameset = {"Joe", "Sally", "Liam", "Robert", "Emma", "Isabella"} print("Contents of nameset is: ", nameset) # print contents of the set in for loop for name in nameset: print(name) # check length of the set print("Length of the set is: ", len(nameset)) # check if certain item is ...
true
25c16ff3deb8922b8c80f1cd92e067134e627c3f
tyerq/checkio
/most-wanted-letter.py
975
4.21875
4
def checkio(text): text = text.lower() max_freq = 0 max_letter = '' for letter in text: if letter.isalpha(): num = text.count(letter) if num > max_freq or num == max_freq and letter < max_letter: max_freq = num max_letter = l...
true
8336c2ce6d87cc7718a3b2af83d3bba7d7ab82b5
KhadarRashid/2905-60-Lab5
/sql_db.py
2,844
4.28125
4
import sqlite3 db = 'records_db.sqlite' def main(): # calling functions in the order they should execute menu() drop_table() create_table() data() def menu(): # Creating a super simple menu choice = input('\nPlease choose one of the following here \n 1 to add \n 2 to delete\n 3 to show ...
true
424d1d4a40d34097b15d71f502fdf5979d95d6c7
jamesmmatt/Projects
/Python/FizzBuzz.py
570
4.375
4
""" Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz" """ def fizzBuz(lastNumber): numRange = range(1, (lastNumber + 1)) for num ...
true
8594a9a864bcf64953d418b4220eb6f98c5a1070
francisco-igor/ifpi-ads-algoritmos2020
/G - Fabio 2a e 2b - Condicionais/G - Fabio 2a - Condicionais/G_Fabio_2a_q18_operações.py
1,190
4.21875
4
'''Leia dois valores e uma das seguintes operações a serem executadas (codificadas da seguinte forma: 1 – Adição, 2 – Subtração, 3 – Multiplicação e 4 – Divisão). Calcule e escreva o resultado dessa operação sobre os dois valores lidos.''' # ENTRADA def main(): valor1 = int(input('Digite um valor: ')) v...
false
f8cf1b25f2f1d6d6567057734546c79fc2b7bf94
francisco-igor/ifpi-ads-algoritmos2020
/G - Fabio 2a e 2b - Condicionais/G - Fabio 2a - Condicionais/G_Fabio_2a_q29_quadrado_perfeito.py
823
4.15625
4
'''Um número é um quadrado perfeito quando a raiz quadrada do número é igual à soma das dezenas formadas pelos seus dois primeiros e dois últimos dígitos. Exemplo: √9801 = 99 = 98 + 01. O número 9801 é um quadrado perfeito. Escreva um algoritmo que leia um número de 4 dígitos e verifique se ele é um quadrado perfeit...
false
c8d583db90939476c5a02e41b49f0d086400f4c7
vivia618/Code-practice
/Reverse words.py
593
4.3125
4
# Write a function that reverses all the words in a sentence that start with a particular letter. sentence = input("Which sentence you want to reverse? : ").lower() letter = input("Which letter you want to reverse? : ").lower() word_in_sentence = sentence.split(" ") new_sentence = [] def special_reverse(x, y): x...
true
c759b9b0b77b38d773482210b6b86685f67b224d
TejshreeLavatre/CrackingTheCodingInterview
/Data Structures/Chpt1- Arrays and Strings/3-URLify.py
871
4.3125
4
""" Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold the additional characters, and that you are given the "true" length of the string. (Note: If implementing in Java, please use a character array so that you can perform this operation i...
true
d56969b05ab1673ebae52b003332e6f53e4003dd
CaosMx/100-Python-Exercises
/011.py
606
4.28125
4
""" Create a script that generates and prints a list of numbers from 1 to 20. Please do not create the list manually. """ x = range(1,21) print(list(x)) # Create a script that generates and prints a list of numbers from 1 to 20. Please do not create the list manually. # 1 Punto # El truco es castear el resultado co...
true
bee12643fb9c7979b52d053d7c3ac2946c26d765
NiraliSupe/Sample-Python-Programs
/Sqlite3/Database.py
1,660
4.8125
5
''' Program created to learn sqlite3 ''' import sqlite3 class Database: def __init__(self): self.conn = sqlite3.connect('UserInfo.db') self.cur = self.conn.cursor() print("success") def createTable(self): table_exists = 'SELECT name FROM sqlite_master WHERE type="table" AND name="USERS"' sql = 'CREAT...
true
e54b29af4b636fa822a4915dbe5180cffb6dc12b
aabeshov/PP2
/String3.py
305
4.28125
4
b = "Hello, World!" print(b[2:5]) # show symbold on the 2th 3th 4th positions a = "Hello, World!" print(b[:5]) # show symbols til the 5th position b = "Hello, World!" print(b[2:]) # show symbold from 2th position til the end b = "Hello, World!" # Its the same but it starts from the ending print(b[-5:-2])
true
64c2a87d7e11c7b5a097feb609cb293626690133
rojcewiczj/Javascript-Python-practice
/Python-Practice/acode_break.py
597
4.21875
4
code = "asoidjfiej;akfgnrgjwalkaslkdjhfaasdfj;asdkjf;gforwarddhjfajkhfthendfijaifgturndksoejkgorightsdfupsdfasdfgg" words= ["walk", "forward", "then", "turn", "right"] # function for finding a message consisting of given words hidden in a jumbled string def find_message(code, words): inc = 0 dictionary = {} ...
false
3664d30966db44495bf24bc707f34715795552b6
rolandoquiroz/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
491
4.46875
4
#!/usr/bin/python3 """ This module contains a function that appends a string at the end of a text file (UTF8) and returns the number of characters added. """ def append_write(filename="", text=""): """ append_write- Appends a string at the end of a text file (UTF8). Args: filename(str): filename...
true
bf9d7fee49b488567c0e8319f138487c0455116c
eujonas/Python
/Aula 03/questao09.py
936
4.28125
4
"""9 - Gere as seguintes listas utilizando for e o metodo range(): Uma lista de ímpares de 10 a 12o Uma lista pares de 2 a 1000 Uma lista de multiplos de 2 em um intervalo de decrescente de 100 até 40 Uma lista de primos de 44 até 99 OBS: Pesquise pelo método append() na documentação """ #IMPARES impares = [] for i i...
false
6fbff7a74b6fcfd9489b5939b089dcf5f245629d
dgellerup/laminar
/laminar/laminar_examples.py
1,574
4.25
4
import pandas as pd def single_total(iterable, odd=False): """This example function sums the data contained in a single iterable, i.e. a list, tuple, set, pd.Series, etc. Args: iterable (list, tuple, set, pd.Series, etc): Any iterable that holds data that can be added together. ...
true
39d5bd7a475870006014f9f9ee2906ebe35c3271
navarr393/a-lot-of-python-projects
/6_7.py
474
4.125
4
information = {'first_name':'David', 'last_name': 'Navarro', 'age':21, 'city':'Los Angeles'} information2 = {'first_name':'Maria', 'last_name': 'Lopez', 'age':25, 'city':'Fullerton'} information3 = {'first_name':'Steph', 'last_name': 'Kun', 'age':23, 'city':'Palos Verdes'} people = [information, information2, info...
false
4a4127a94f0b510000be3724caa6f204ac602025
leqingxue/Python-Algorithms
/Lecture01/Labs/Lab01/rec_cum_solution.py
715
4.125
4
# Write a recursive function which takes an integer and computes the cumulative sum of 0 to that integer # For example, if n=4 , return 4+3+2+1+0, which is 10. # This problem is very similar to the factorial problem presented during the introduction to recursion. # Remember, always think of what the base case will loo...
true