blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
dddb2bfd290929643eb202396aecd88df6d51e0f
Catering-Company/Capstone-project-2
/Part2/sub_set_min_coin_value.py
1,889
4.75
5
# CODE FOR SETTING THE MINIMUM COIN INPUT VALUE ( CHOICE 2 OF THE SUB-MENU ) # -------------------------------------------------- # Gets the user to input a new minimum amount of coins that the user can enter # into the Coin Calulator and Mutiple Coin Calculator. # There are restrictions in place to prevent the user ...
true
b27bdc20978ca3365e8fe5b87f1f1207f7d48774
nish235/PythonPrograms
/Oct15/ArmstrongWhile.py
252
4.125
4
num = int(input("Enter a number: ")) s = 0 temp = num while temp > 0: dig = temp % 10 s = s + dig ** 3 temp = temp // 10 if s == num: print(num, "is an Armstrong number") else: print(num, "is not an Armstrong number")
false
f2725f5d5f4b12d7904d271873c421c99ff2fe9f
MagRok/Python_tasks
/regex/Python_tasks/Text_stats.py
1,627
4.15625
4
# Create a class that: #• When creating an instance, it required entering the text for which it will count statistics. # The first conversion occurred when the instance was initialized. #Each instance had attributes: - lower_letters_num - which stores the number of all lowercase letters in the text #- upper_letters_num...
true
ad88d60e5b4b5ab7c77df24182ec07525e213411
hulaba/geekInsideYou
/trie/trieSearch.py
2,112
4.125
4
class TrieNode: def __init__(self): """ initializing a node of trie isEOW is isEndOfWord flag used for the leaf nodes """ self.children = [None] * 26 self.isEOW = False class Trie: def __init__(self): """ initializing the trie data structure with...
true
0d877b43c404c588ef0dbacd8c93c94b17534359
hulaba/geekInsideYou
/tree/levelOrderSpiralForm.py
1,421
4.1875
4
""" Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. spiral_order """ class Node: def __init__(self, key): self.val = key self.left = None self.right = None def spiralOrder(root): h = heightOfTree(root) ltr = F...
true
c9177860241ba612a10c13afa03ef7f201f22fee
hulaba/geekInsideYou
/matrix/matrixSubtraction.py
477
4.1875
4
def subtractMatrix(A, B, N): """ Function to SUBTRACT two matrices N: rows and columns of matrices respectively A, B: two input matrices """ C = A[:][:] for i in range(N): for j in range(N): C[i][j] = A[i][j] - B[i][j] print(C) if __name__ == '__main__': ...
false
8bbd84f22d9af1917de39200a00c0a8edeb81a34
hulaba/geekInsideYou
/linked list/deleteListPosition.py
1,403
4.15625
4
class Node: def __init__(self, data): """initialising the data and next pointer of a node""" self.data = data self.next = None class linkedList: def __init__(self): """initialising the head node""" self.head = None def push(self, new_data): """inserting t...
true
1ebf124d42d510c2e60c3c7585c03e0efd6dad18
gnsisec/learn-python-with-the-the-hard-way
/exercise/ex14Drill.py
871
4.21875
4
# This is Python version 2.7 # Exercise 14: Prompting and Passing # to run this use: # python ex14.py matthew # 2. Change the prompt variable to something else entirely. # 3. Drill: Add another argument and use it in your script, # the same way you did in the previous exercise with first, second = ARGV. from sys imp...
true
1804f578c7ff417744edc804043b2016d8bcde4a
paulocuambe/hello-python
/exercises/lists-execises.py
554
4.21875
4
my_list = ["apple", "banana", "cherry", "mango"] print(my_list[-2]) # Second last item of the list my_list.append("lemon") if "lemon" in my_list: print("Yes, that fruit is in the list.") else: print("That fruit is not in the list.") my_list.insert(2, "orange") print(my_list) new_list = my_list[1:] print(n...
true
45ab566c204a9a593871d670c1c0e206fa3949fd
paulocuambe/hello-python
/exercises/dictionaries/count_letter.py
367
4.125
4
""" Count how many times each letter appears in a string. """ word = "lollipop" # Traditional way trad_count = dict() for l in word: if l not in trad_count: trad_count[l] = 1 else: trad_count[l] += 1 print(trad_count) # An elegant way elegant_count = dict() for l in word: elegant_count[l] ...
true
3ce28a5ff5d7c9f5cf2daa6a5f6f5ff955e29017
paulocuambe/hello-python
/exercises/oop/first.py
507
4.15625
4
class Animal: name = "" def __init__(self, name): self.name = name print(f"\n----{self.name} Is in the creation process.----\n") def walk(self): """ Walk a tiny bit """ print(f"{self.name} is walking...") def __del__(self): print(f"\n----{self.n...
false
6d44a9e3a466e1274ccdd2aa95a756a1372991d2
paulocuambe/hello-python
/exercises/loops/min_max.py
512
4.125
4
maximum = minimun = None count = 0 while True: user_input = input("Enter a number: ") if user_input == "done": break try: number = float(user_input) if count == 0: maximum = number minimum = number elif number > maximum: maximum = number ...
false
fccfaac6346eaf23b345cd2117cda259fd83ff80
MrinaliniTh/Algorithms
/link_list/bring_last_to_fast.py
1,663
4.15625
4
class Node: def __init__(self, val): self.val = val self.next = None class LinkedList: def __init__(self): self.head = None def create_link_list(self, val): if not self.head: self.head = Node(val) else: temp = self.head while temp...
true
536f849236a984329df99fb2c2e286e3329c6ad4
juliettegodyere/MIT-Electrical-Engineering-and-Computer-Science-Undergraduate-Class
/Year 1/Intro to Computer Science & Programming/Problem Sets/ps0/ps0.py
259
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 2 18:13:11 2021 @author: nkworjuliet """ # import math x = int(input("Enter a value....")) y = int(input("Enter a value....")) pow = x**y print(pow) log = int(math.log(x, 2)) print(log)
false
f6ffc7845a7a3e8c06bd5f49b01cf83115bda42f
zhujixiang1997/6969
/7月11日/判断语句.py
496
4.21875
4
''' 判断程序的过程:从上到下,从左到右依次执行 判断语句:if 判断条件: 满足条件后执行的代码块 当所有条件都不满足就执行else语句,else语句只能放在最后,可以不写 判断i语句必须是if开始 chr()字符 会将数字转换成对应的ASCCII ASCII a=97 b=98 A=65 B=66 ''' a=float(input('请输入:')) if a==10: print(a,'等于10') elif a<10: print(a,'小于10') else : print(a,'大于10')
false
12188e2e3aab8ce6b85fbf97f24cca2e6790b6a8
zhujixiang1997/6969
/7月11日/类型转换.py
433
4.1875
4
''' 数字可以和数字直接运算 整数和字符串不能够运算 只有同类型的数据才能运算 字符串的加法运算:是拼接 整数和字符串做加法运算,除非字符串的内容是数字 我们可以将字符串转换为整数 转换方式:int(要转换的数据/变量) 将整数转换为字符串str() ''' # a=10 # b='20' # print(a+b) # a=10 # #b=int('20') # b='20' # c=int(b) # print(a+c)
false
b3f14159120e16453abdbd43687885956393e811
TaylorWhitlatch/Python
/tuple.py
967
4.3125
4
# # Tuple is a list that: # # 1. values cannot be changed # # 2. it uses () instead of [] # # a_tuple = (1,2,3) # print a_tuple # # # Dictionaries are lists that have alpha indicies not mumerical # # name = "Rob" # gender = "Male" # height = "Tall" # # # A list makes no sense to tie together. # # person = { # ...
true
aa15c53b44aa7e3cbdc497160964c3566a70c071
cksgnlcjswo/open_source_sw
/midterm/account.py
739
4.15625
4
""" version : 1.5.0 작성자 : 김찬휘 이메일 : cksgnlcjswoo@naver.com description : account 클래스 수정사항 : pythonic-way 적용 """ class Account: def __init__(self, ID, money, name): self.ID = ID #bank number self.balance = money #left money self.name = name def getID(self): return self.ID ...
false
79004d747935ebfc19599a9df859400c47120c7e
PavanMJ/python-training
/2 Variables/variables.py
832
4.1875
4
#!/usr/bin/python3 ## All the variables in python are objects and every object has type, id and value. def main(): print('## checking simple variables and their attributes') n = 12 print(type(n), n) f = 34.23 print(type(f), f) print(f / 4) print(f // 4) print(round(f / 4), end = '\n...
true
fe789098e54d1a7a59573d36fc03a4da0159b552
vuminhph/randomCodes
/reverse_linkedList.py
969
4.1875
4
class Node: def __init__(self, value): self.value = value self.next = None class LinkedList: def __init__(self, value): self.head = Node(value) def add_node(self, value): ptr = self.head while ptr.next != None: ptr = ptr.next ptr.next = Node(va...
true
c4cad7dd1e0fbd6ce87a64cbe613d1c4c1384a20
dmitrijsg123/Problem_Solving
/Week_4_homework.py
404
4.40625
4
# Enter positive integer and perform calculation on it - divide by two if even and multiply by three and add one if odd a = int(input("Enter Positive Number: ")) while a != 1: # while 'a' not equal to one if (a % 2) == 0: # if 'a' is even a = a/2 elif (a % 2) !=...
false
a83a1d0e35bed07b1959086aff1ef4f7a872520e
rpayal/PyTestApp
/days-to-unit/helper.py
1,232
4.40625
4
USER_INPUT_MESSAGE = "Hey !! Enter number of days as a comma separated list:unit of measurement (e.g 20, 30:hours) " \ "and I'll convert it for you.\n " def days_to_hours(num_of_days, conversion_unit): calculation_factor = 0 if conversion_unit == "hours": calculation_factor = 24 ...
true
05564cfff12bdf3b73b32f3f4c8b484046ff3d91
PatDaoust/6.0002
/6.0002 ps1/ps1b adapt from teacher.py
2,717
4.125
4
########################### # 6.0002 Problem Set 1b: Space Change # Name: # Collaborators: # Time: # Author: charz, cdenise #================================ # Part B: Golden Eggs #================================ # Problem 1 def dp_make_weight(egg_weights, target_weight, memo = {}): """ Find number of eggs t...
true
188c7e74ae3c05206ec4cdebd9b18fac6bc4aa1a
matrix231993/cursopython2021
/TAREA_PYTHON/TAREA_PYTHON_1/ejercicio13.py
269
4.125
4
#EJERCICIO 13.- Pedir un número por teclado y mostrar la tabla de multiplicar multi = int(input("ingrese un numero para la tabla de multiplicacion")) m = 1 while m <= 12: print(multi,"x", m, "=", multi*m) m+=1 print("aqui esta la tabla de multiplicar",multi)
false
350dc18eb4123270227f538c191dbe10a631a619
matrix231993/cursopython2021
/Unidad2/listas.py
2,440
4.5
4
# Lista en python lista_enteros = [1,2,3,4,5] # Lista de Enteros lista_float = [1.0,2.0,3.5,4.5,5.5] # Lista de floats lista_cadenas = ["A","B",'C','SE',"HO"] # Lista de string lista_general = [1, 3.5, "Cadena1", True] #Lista de tipo multiples # 0 1 2 3 # Acceder a los elemento...
false
fb79529c283581cb63efacaacbb71932458420a6
Lucas-Urbano/Python-for-Everybody
/Dictionarie6.py
758
4.375
4
Movie1 = {'Título':'Star Wars', 'ano': '1977', 'diretor': 'George Lucas'} Movie2 = {'Título':'Indiana Jones e os salteadores da arca perdida', 'ano': '1981', 'diretor': 'Steven Spielberg'} Movie3 = {'Título':'Matrix', 'ano': '1999', 'diretor': 'Irmãos Wachowski'} Movie1['País'] = 'EUA' #add keys e value in a dictionary...
false
6df61f24bfe1e9943ac01de9eec80caad342c8a9
rootid23/fft-py
/arrays/move-zeroes.py
851
4.125
4
#Move Zeroes #Given an array nums, write a function to move all 0's to the end of it while #maintaining the relative order of the non-zero elements. #For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums #should be [1, 3, 12, 0, 0]. #Note: #You must do this in-place without making a copy of the ...
true
574f2fa0a57b335db183ee690bfe2da896c957c6
hmlmodi/Python-Playground
/New folder/final ready game.py
894
4.1875
4
import random choice = int(input('enter your choice:')) user_choice = choice comp_choice = random.randint(1, 3) print(user_choice) print(comp_choice) logic = "TWLLTWWLT" print(logic[(((user_choice) * 3) + (comp_choice)) ]); # if (user_choice == 1 and comp_choice == 2) or (comp_choice == 1 and user_choice == 2): ...
false
85b9bec9a1ceea4ee661b59c7efc82595e30f871
Anand8317/food-ordering-console-app
/admin.py
2,127
4.15625
4
admin = {"admin":"admin"} food = dict() def createAdmin(): newAdmin = dict() username = input("Enter username ") password = input("Enter password ") newAdmin[username] = password if username in admin: print("\nAdmin already exist\n") else: admin.update(newAdmin) ...
true
c9033580121ba38277facb1729565d15a994b8b6
Ani-Stark/Python-Projects
/reverse_words_and_swap_cases.py
419
4.15625
4
def reverse_words_order_and_swap_cases(sentence): arrSen = sentence.split() arrSen = list(reversed(arrSen)) result = list(" ".join(arrSen)) for i in range(len(result)): if result[i].isupper(): result[i] = result[i].lower() else: result[i] = result[i].upper() ...
true
e0857fdba34db0f114bcf7843f844aea775303e7
Villanity/Python-Practice
/Reverse Array/Reverse_Array_while.py
343
4.59375
5
#Python program to reverse the array using iterations def reverse_array (array1, start, end): while (start<=end): array1[start], array1[end] = array1[end], array1[start] start += 1 end -= 1 A = [1, 2, 2 , 3, 4] start=0 end= len(A) -1 print(A) print("The reversed Array is: ") reverse_array(A...
true
e1b54f773e836e5508ad935765be9c56f13c5d91
rashmika13/sei
/w07/d2/python-control-flow/exercise-instructor.py
1,022
4.21875
4
# color = input('Enter "green", "yellow", "red": ').lower() # while color != 'quit': # print(f'The user entered {color}') # if color == 'green': # print('Go!') # elif color == 'yellow': # print('Slow it doooowwwwnnnnn') # elif color == 'red': # print('Stop!') # else: # ...
false
fb67e1eff16e1804ecf9c2e4ff0010962bb930c3
guyitti2000/int_python_nanodegree_udacity
/lessons_month_one/lesson_3_FUNCTIONS/test.py
263
4.21875
4
def times_list(x): x **= 2 return x output = [] numbers = [2, 3, 4, 3, 25] for num in numbers: val = times_list(numbers) print(output.append(val)) # this is supposed to iterate through a list of numbers then print out the squares
true
093d56467f6309b099b8e2210efe8ecaca8397eb
shanahanben/myappsample
/Portfolio/week6/article_four_word_grabber.py
564
4.15625
4
#!/usr/bin/python3 import random import string guessAttempts = 0 myPassword = input("Enter a password for the computer to try and guess: ") passwordLength = len(myPassword) while True: guessAttempts = guessAttempts + 1 passwordGuess = ''.join([random.choice(string.ascii_letters + string.digits)for n in ...
true
360b36c700983e8cddb0049dded9d78abe12b75a
steve-ryan/python-tutorial-for-beginners
/list.py
1,226
4.1875
4
name = ['ken','sam','antony'] list("wachira") # split print("hello am steve wachira." .split("ac")) # print name # print test # adding list cuzo = ['shifrah','shikoh'] cuzo.append('bilhah') print(cuzo) #add list .insert() test_point = [90,87,17,56] test_point.insert(1,50) print(test_point) #extend test_point = [90,...
false
106ddf889cd1ac1fb1b4e6fe1beef995982c4c31
tajrian-munsha/Python-Basics
/python2 (displaying text and string).py
2,391
4.53125
5
# displaying text #to make multiple line we can- 1.add \n in the string or, 2.use print command again and again.\n means newline. print ("I am Shawki\n") #we can use \t in the string for big space.\t means TAB. print ("I am a\t student") #we can use triple quotes outside the string for newline.For doing that,we can ...
true
0812e177cd0f9b5e766f6f981b4bc1947946fa22
akhilreddy89853/programs
/python/Natural.py
288
4.125
4
Number1 = int(input("How many natural numbers you want to print?")) Count = 0 Counter = 1 print("The first " + str(Number1) + " natural numbers are", end = '') while(Count < Number1): print(" "+str(Counter), end = '') Counter = Counter + 1 Count = Count + 1 print(".")
true
2363bdd68dbef23b937b82cce046974e847c43a4
sunrocha123/Programas_Estudo_Python
/coeficienteBinomial.py
668
4.15625
4
import math # exibição do cabeçalho def cabecalho(): print("===================================") print("CÁLCULO DO COEFICIENTE BINOMIAL") print("===================================") print('') # cálculo do coeficiente binomial def coeficienteBinomial(n, p): calculo = math.factorial(n)/(math.fac...
false
7a9ed1b59eca36822827d20359aa1b1eb9292d52
JeRusakow/epam_python_course
/homework7/task2/hw2.py
1,861
4.4375
4
""" Given two strings. Return if they are equal when both are typed into empty text editors. # means a backspace character. Note that after backspacing an empty text, the text will continue empty. Examples: Input: s = "ab#c", t = "ad#c" Output: True # Both s and t become "ac". Input: s = "a##c", t = ...
true
f226cabe15ea1b978dcb8015c040575394d90fbf
JeRusakow/epam_python_course
/tests/test_homework1/test_fibonacci.py
1,083
4.125
4
from homework1.task2.fibonacci.task02 import check_fibonacci def test_complete_sequence(): """Tests if true sequence starting from [0, 1, 1, ... ] passes the check""" test_data = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] assert check_fibonacci(test_data) def test_sequence_fragment(): """Tests if tru...
true
95bdedbc353d1b86f536777b28f8fca63990d8bc
kevindurr/MOOCs
/Georgia Tech - CS1301/Test/6.py
1,693
4.21875
4
#Write a function called are_anagrams. The function should #have two parameters, a pair of strings. The function should #return True if the strings are anagrams of one another, #False if they are not. # #Two strings are considered anagrams if they have only the #same letters, as well as the same count of each letter. F...
true
622b856988a7621b09fca280ba2564a593df37e1
kevindurr/MOOCs
/Georgia Tech - CS1301/Objects & Algos/Algos_5_2/Problem_Set/5.py
1,403
4.375
4
#Write a function called search_for_string() that takes two #parameters, a list of strings, and a string. This function #should return a list of all the indices at which the #string is found within the list. # #You may assume that you do not need to search inside the #items in the list; for examples: # # search_for_st...
true
a7b544425be8d629667975fc19983028bbe51136
Ebi-aftahi/Files_rw
/word_freq.py
735
4.125
4
import csv import sys import os file_name = input(); if not os.path.exists(file_name): # Make sure file exists print('File does not exist!') sys.exit(1) # 1 indicates error items_set = [] with open(file_name, 'r') as csvfile: csv_reader = csv.reader(csvfile, delimiter=','...
true
7bb3dc041d323337163fab2cf5a19ef6e97c94c2
DharaniMuli/PythonAndDeepLearning
/ICPs/ICP-3/Program1_e.py
1,627
4.21875
4
class Employee: data_counter = 0 total_avg_salary = 0 total_salary = 0 # List is a class so I am creating an object for class mylist = list() def __init__(self, name, family, salary, department): self.empname = name self.empfamily = family self.empsalary = salary ...
true
df79f1a4a72a30fe40de567859db42fbb44e8f5d
echedgy/prg105fall
/3.3 Nested Ifs.py
1,247
4.21875
4
package = input("Which package do you have? (A, B, C): ") print("You entered Package " + package) minutes_used = int(input("How many minutes did you use this month? ")) package_price = 0.0 if package == "A" or package == "a": package_price = 39.99 if minutes_used > 450: additional_minutes = min...
true
93746c4f02729852c13d04b1de64a729a6a07dd8
echedgy/prg105fall
/11.2 Production Worker.py
816
4.28125
4
# Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts # the user to enter data for each of the object’s data attributes. # Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the screen. import employ...
true
112a19946aef220606d17f2f547e67a58da7da03
echedgy/prg105fall
/2.3 Ingredient Adjuster.py
1,089
4.46875
4
# A cookie recipe calls for the following ingredients: # 1.5 cups of sugar # 1 cup of butter # 2.75 cups of flour # The recipe produces 48 cookies with this amount of ingredients. Write a program that asks the user # how many cookies they want to make, and then displays the number of cups # (to two decimal places...
true
08e291f0d7343d98f559e10755ac64ebf74d652c
varaste/Practice
/Python/PL/Python Basic-Exercise-6.py
1,064
4.375
4
''' Python Basic: Exercise-6 with Solution Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers. Python list: A list is a container which holds comma separated values (items or elements) between square brackets where items or e...
true
6fdf3e5c757f7de27c6afb54d6728116d9f3ae55
varaste/Practice
/Python/PL/Python Basic-Exercise-4.py
553
4.3125
4
''' Write a Python program which accepts the radius of a circle from the user and compute the area. Python: Area of a Circle In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumf...
true
0173ae9e82213f4f01ccc6239a152b7ad0c5f8ad
varaste/Practice
/Python/PL/Python tkinter widgets-Exercise-8.py
756
4.21875
4
''' Python tkinter widgets: Exercise-8 with Solution Write a Python GUI program to create three single line text-box to accept a value from the user using tkinter module. ''' import tkinter as tk parent = tk.Tk() parent.geometry("400x250") name = tk.Label(parent, text = "Name").place(x = 30, y = 50) ema...
true
285451e05017f8598ff68eb73ae537ca2e0922a5
varaste/Practice
/Python/PL/Python Basic-Exercise-27-28-29.py
1,554
4.1875
4
''' Python Basic: Exercise-27 with Solution Write a Python program to concatenate all elements in a list into a string and return it. ''' def concat(list): output = "" for element in list: output = output + str(element) return output print(concat([1, 4, 0, 0,"/" , 0, 7,"/" ,2, 0])) ...
true
0ed76e4bb935107504ffed0f3b77804d7f42cdc2
varaste/Practice
/Python/PL/Python tkinter widgets-Exercise-7.py
688
4.21875
4
''' Python tkinter widgets: Exercise-7 with Solution Write a Python GUI program to create a Text widget using tkinter module. Insert a string at the beginning then insert a string into the current text. Delete the first and last character of the text. ''' import tkinter as tk parent = tk.Tk() # create the ...
true
3604cfb0531dd9798b43facc91326533df969594
michalkasiarz/automate-the-boring-stuff-with-python
/lists/multipleAssignmentSwap.py
261
4.21875
4
# Multiple assignment - swap a = "AAA" # a is AAA b = "BBB" # b is BBB print("a is " + a) print("b is " + b) print() # swap a, b = b, a # a is now b, i.e. a = BBB, and b = AAA print("a is " + a) # a is BBB print("b is " + b) # b is AAA
false
897a1b3f11bc3f0352e61ed6802094bd6c341729
michalkasiarz/automate-the-boring-stuff-with-python
/regular-expressions/usingQuestionMark.py
499
4.125
4
import re # using question mark -> for something that appears 1 or 0 times (preceding pattern) batRegex = re.compile(r"Bat(wo)?man") mo = batRegex.search("The Adventures of Batman") print(mo.group()) # Batman mo = batRegex.search("The Adventures of Batwoman") print((mo.group())) # Batwoman # another example with ...
true
9393e65692d8820d71fdda043da48ec33658b467
michalkasiarz/automate-the-boring-stuff-with-python
/dictionaries/dataStructures.py
686
4.125
4
# Introduction to data structure def printCats(cats): for item in cats: print("Cat info: \n") print("Name: " + str(item.get("name")) + "\nAge: " + str(item.get("age")) + "\nColor: " + str(item.get("color"))) print() cat = {"name": "Parys",...
true
c795f6ac170f96b398121ddbbc9a22cf13835061
AshwinBalaji52/Artificial-Intelligence
/N-Queen using Backtracking/N-Queen_comments.py
2,940
4.125
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 1 00:42:23 2021 @author: Ashwin Balaji """ class chessBoard: def __init__(self, dimension): # board has dimensions dimension x dimension self.dimension = dimension # columns[r] is a number c if a queen is placed at row r and column ...
true
dee277547fa6e80610a419c7285ff2074e0078cf
tejadeep/Python_files
/tej_python/basics/add.py
287
4.28125
4
#program by adding two numbers a=10 b=20 print"%d+%d=%d"%(a,b,a+b) #this is one method to print using format specifiers print"{0}+{1}={2}".format(a,b,a+b) #this is one method using braces #0 1 2 print"{1}+{0}={2}".format(a,b,a+b) # here output is 20+10=30
true
0ddac05ddceaa96fc1a31d35d43e91bedd70dc8e
dannikaaa/100-Days-of-Code
/Beginner Section/Day2-BMI-Calulator.py
418
4.3125
4
#Create a BMI Calculator #BMI forumula #bmi = weight/height**2 height = input("Enter your height in m: ") weight = input("Enter your weight in kg: ") #find out the type of height & weight #print(type(height)) #print(type(weight)) #change the types into int & float int_weight = int(weight) float_height = float(hei...
true
2c36c65ec38d2c8a3806e962804ec927353d0be4
v0001/python_jw
/Basic/repeat test/repear test_exam5 copy.py
789
4.1875
4
# 삼각형의 밑변의 길이와 높이를 입력받아 넓이를 출력하고, "Continue? "에서 하나의 문자를 입력받아 그 문자가 'Y' 나 'y' 이면 작업을 반복하고 다른 문자이면 종료하는 프로그램을 작성하시오. # (넓이는 반올림하여 소수 첫째자리까지 출력한다.)​ # a = 'y' # while(a.upper() == 'Y'): # # b = input().strip().split() # # Base = int(b[0]) # # Height = int(b[1]) # Base = int(input("Base = ")) # Heig...
false
3fd9c30f76f11696abac88e60cc1ce28c212b729
akashbhalotia/College
/Python/Assignment1/012.py
554
4.25
4
# WAP to sort a list of tuples by second item. # list1.sort() modifies list1 # sorted(list1) would have not modified it, but returned a sorted list. def second(ele): return ele[1] def sortTuples(list1): list1.sort(key=second) inputList = [(1, 2), (1, 3), (3, 3), (0, 3), (3, 5), (7, 2), (5, 5)] print('Input...
true
c52de657a3ae4643f627703138e86bc03d8383dc
momentum-cohort-2019-02/w3d3-oo-pig-yyapuncich
/pig.py
2,594
4.15625
4
import random class ComputerPerson: """ Computer player that will play against the user. """ def __init__(self, name, current_score=0): """ Computer player will roll die, and automatically select to roll again or hold for each turn. They will display their turn totals after each tu...
true
10acda48e124a1de9ed342e17e4987b5f766e39e
ZakirovRail/GB_Python_Faculty
/1_quarter/Python_basic/Basic_course_Lesson_1/Basic_course_Lesson_1_5_HW_Rail_Zakirov.py
1,310
4.28125
4
""" 5. Запросите у пользователя значения выручки и издержек фирмы. Определите, с каким финансовым результатом работает фирма (прибыль — выручка больше издержек, или убыток — издержки больше выручки). Выведите соответствующее сообщение. Если фирма отработала с прибылью, вычислите рентабельность выручки (соотношение приб...
false
b91fa84d9b4c884a9352139ac4f13742ef577212
ZakirovRail/GB_Python_Faculty
/1_quarter/Python_basic/Basic_course_Lesson_3/Basic_course_Lesson_3_2_HW_Rail_Zakirov.py
1,294
4.34375
4
""" 2) Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: имя, фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы. Реализовать вывод данных о пользователе одной строкой. """ # def user_data(name, surname, birth_yea...
false
b6d518a4d5c829045cc4b19c1a0630422cf38050
SwethaVijayaraju/Python_lesson
/Assignments/Loops/Biggest number divisible.py
522
4.25
4
#write a function that returns the biggest number divisible by a divisor within some range. def biggest(num1,num2,divisor): bignum=None while num1<=num2: if (num1%divisor)==0: bignum=num1 num1=num1+1 return bignum print(biggest(1,10,2)) #answer should be 10 #write a function that returns the biggest nu...
true
0c303b2ae10529b5cfa2ec2e5896c5b6d7507303
SwethaVijayaraju/Python_lesson
/Assignments/Loops/Palindrome.py
549
4.15625
4
# check if the given string is palindrome or not #a="swetha" then a[0] equals 's' def reverse(word): length = len(word) final = "" for a in word: final = final + word[length - 1] length = length - 1 return final def palindrome(word): return word == reverse(word) print(palindrome...
false
3a160588ec768a4c94929f6c4f8e0174af9946b5
gkabbe/MiniPython
/15.11.2016/4_bool.py
2,846
4.15625
4
"""Boolesche Ausdrücke und if-Statements Bisher waren unsere Programme noch recht simpel gestrickt und waren nicht in der Lage, mehr als ein gewöhnlicher Taschenrechner zu machen. Hier wird nun gezeigt, wie man ein Programm schreibt, das gewissermaßen Entscheidungen treffen kann, d.h. auf unterschiedliche Situationen ...
false
db73a48731ed073e252d56eedc05c98588ba1675
jayednahain/python-Function
/function_mix_calculation.py
386
4.15625
4
def addition(x,y): z=x+y return print("the addtion is: ",z) def substruction(x,y): z=x-y return print("the substruction is : ",z) def multiplication(x,y): z=x*y return print("the multiplication is :",z) a = int(input("enter a number one : ")) b = int(input("enter second nu...
true
c1d1bcd4a998a60f8f0b73df988e2984337810b5
eudys07/PythonKata
/Collections/Dictionary_implementation.py
1,744
4.125
4
#Dictionary print print 'Creating new Dictionary' print dict1 = {'name':'Eudys','lastname':'Bautista','age':31} dict2 = dict([('name','Aynel'),('lastname','Bautista'),('age',28)]) dict3 = dict(name='Eliel',lastname='Garcia',age=32) print 'dict1: ' print dict1 print 'dict2: ' print dict2 print 'dict3: ' print dict3 ...
false
edebe64f2a8f06539214fc7e2771e56a73130405
Abijithhebbar/abijith.hebbar
/cspp1/m22 exam/assignment3/tokenize.py
1,107
4.21875
4
''' Write a function to tokenize a given string and return a dictionary with the frequency of each word ''' # output_dictionary = {} def tokenize(string_input): """Tokenize function""" output_dictionary = {} new_string = '' for word in string_input: if word not in "`~!@#$%^&*()_+=.,;-\''": ...
false
7a3c29e08029bdbfd42dbda0b6cc6c22144d01c8
Nate-17/LetsUpgrade-Python
/primenumber.py
444
4.28125
4
''' This is a module to check weather the given number is even or odd.'' ''' def prime(num): ''' This is the main function which check out the given number is even or odd. ''' if num > 1: for i in range(2, num): if (num % i) == 0: break return p...
true
481c5bf7331c477e037b13df745ebd49dfeed605
Zeranium/PythonWorks
/Ch06/p157.py
371
4.21875
4
""" 날짜 : 2021/02/25 이름 : 장한결 내용 : 교재 p157 - self 명령어 예 """ class multiply3: def data(self, x, y): self.x = x self.y = y def mul(self): result = self.x * self.y self.display(result) def display(self, result): print('곱셈 = %d' % (result)) obj = multiply3() obj.data(...
false
686c1f0c8ebec7caade9bd99e8c45b5581e421e1
SweetLejo/DATA110
/past_exercises_leo/yig012_t2.py
1,562
4.28125
4
#Oppgave 1 from math import pi #imports pi from the math library, since its the only thing I'll use in this exercise it felt redundant to import the whole library radius = float(input('Radius: ')) #promts the user to enter a radius area = round((radius**2)*pi, 3) #defines a variable as the area, and rounds it to 3...
true
fac04373d57b33f9dd8298e01aaf36f0ebb3fb75
wonderme88/python-projects
/src/revstring.py
285
4.40625
4
# This program is to reverse the string def revStr(value): return value[::-1] str1 = "my name is chanchal" str2 = "birender" str3 = "chanchal" #print revStr(str1) list = [] list.append(str1) list.append(str2) list.append(str3) print (list) for x in list: print revStr(x)
true
e10a0af7adca68109ebeb211ad994b2877c5a52d
EugenieFontugne/my-first-blog
/test/python_intro.py
835
4.125
4
volume = 18 if volume < 20: print("It's kinda quiet.") elif 20 <= volume < 40: print("It's nice for background music") elif 40 <= volume < 60: print("Perfect, I can hear all the details") elif 60 <= volume < 80: print("Nice for parties") elif 80 <= volume < 100: print("A bit loud!") else: print("My hears are hurt...
true
3eb6198afa9481a86e43c80b29b1156c64108dc0
JI007/birthdays
/birthday search.py
2,316
4.3125
4
def birthday(): birthdays = {'Jan': ' ','Feb': ' ', 'Mar': ' ', 'Apr': ' ', 'May': 'Tiana (10), Tajmara (11) ', 'June': ' ', 'July': 'Jamal (7)', 'Aug': 'Richard (7) ', 'Sept': 'Nazira (16) ', 'Oct': ' ', 'Nov': ' ', 'Dec': ' '} birthday() # Welcomes the user to the program print("\n\n\t\tWelcome to th...
true
6d75e4824f163c52a0ddd62d308750ee12a60ac0
lvmodan/LPTHW
/ex42hasaisaEn.py
2,397
4.1875
4
#!/usr/bin/env python # coding=utf-8 # Animal is-a object class Animal(object): pass # dog is-a Animal class Dog(Animal): def __init__(self, name): self.name = name def bark(): print 'WANG~' * 3 def wave_tail(): print 'wave its tail happily' # cat is-a Animal class Cat(Animal)...
false
df97a2008ef5f6576c0d100699bef3a4ce706400
Shamita29/266581dailypractice
/set/minmax.py
455
4.21875
4
#program to find minimum and maximum value in set def Maximum(sets): return max(sets) def Minimum(sets): return min(sets) """ setlist=set([2,3,5,6,8,28]) print(setlist) print("Max in set is: ",Maximum(setlist)) print("Min in set is: ",Minimum(setlist)) """ print("Enter elements to be added in set") sets = set(map...
true
6bb7f311bf751f88806e77e17d74d6977f16e264
navneeth824/Numerical-techniques1
/unit_3/interpolation derivative of value in table.py
1,855
4.25
4
# newton forward and backward interpolation derivative # calculating u mentioned in the formula def u_cal(u, n): temp = u; for i in range(1, n): temp = temp * (u - i); return temp; # calculating factorial of given number n def fact(n): f = 1; for i in range(2, n + 1): ...
false
3490d144c4cd81468544c77f7faa8bde3dc23a13
navneeth824/Numerical-techniques1
/unit_3/interpolation derivative of value not in table.py
2,082
4.15625
4
# newton forward and backward interpolation derivative # calculating u mentioned in the formula def u_cal(u, n): temp = u; for i in range(1, n): temp = temp * (u - i); return temp; # calculating factorial of given number n def fact(n): f = 1; for i in range(2, n + 1): ...
false
3165bc53048b76a1fc5c7bc58bef2663c595f69e
zmatteson/epi-python
/chapter_4/4_7.py
335
4.28125
4
""" Write a program that takes a double x and an integer y and returns x**y You can ignore overflow and overflow """ #Brute force def find_power(x,y): if y == 0: return 1.0 result = 1.0 while y: result = x * result y = y - 1 return result if __name__ == "__main__": print(f...
true
7bfff88b28253ec0f69e3c93dc01c29be200e71b
zmatteson/epi-python
/chapter_13/13_1.py
1,092
4.1875
4
""" Compute the intersection of two sorted arrays One way: take the set of both, and compute the intersection (Time O(n + m) ) Other way: search in the larger for values of the smaller (Time O(n log m ) ) Other way: start at both and walk through each, skipping where appropriate (Time O(n + n) , space O(intersection ...
true
af77d80d6b95b5dc847f33ba0783b5fcc7c872d6
zmatteson/epi-python
/chapter_5/5_1.py
1,620
4.21875
4
""" The Dutch National Flag Problem The quicksort algorith for sorting arrays proceeds recursively--it selects an element ("the pivot"), reorders the array to make all the elements less than or equal to the pivot appear first, followed by all the elements greater than the pivot. The two subarrays are then sorted rec...
true
d3e57c2ec3133003e2d8d5f67c2aee403e3ab0e8
zmatteson/epi-python
/chapter_14/14_1.py
959
4.15625
4
""" test if a tree satisfies the BST property What is a BST? """ class TreeNode: def __init__(self, left = None, right = None, key = None): self.left = left self.right = right self.key = key def check_bst(root): max_num = float('inf') min_num = float('-inf') return check_bst_...
true
cad9a59e7ed85cd5f9c7cea130d6589ee7a70bd9
Pyae-Sone-Nyo-Hmine/Ciphers
/Caesar cipher.py
1,362
4.46875
4
def encode_caesar(string, shift_amt): ''' Encodes the specified `string` using a Caesar cipher with shift `shift_amt` Parameters ---------- string : str The string to encode. shift_amt : int How much to shift the alphabet by. ''' ...
true
de6be7734a7996f5bbea60637be01ed928b7ddb4
v4vishalchauhan/Python
/emirp_number.py
669
4.28125
4
"""Code to find given number is a emirp number or not""" """Emirp numbers:prime nubers whose reverse is also a prime number for example:17 is a prime number as well as its reverse 71 is also a prime number hence its a emirp number..""" def prime_check(k): n=int(k) if n<=1: return False for i in range(2,n)...
true
112da86c726bd8f3334258910eae937aff2f8db5
ms99996/integration
/Main.py
1,664
4.1875
4
"""__Author__= Miguel salinas""" """This is my attempt to create a mad lib """ ask = input("welcome to my mad lib, would you like to give it a try? enter " "yes or no, the answer is case sensitive: ") while ask not in ("yes", "no"): ask = input("please type a valid input: ") def get_answers(...
true
2751c555e7013b68edf648c2c5523c3218759546
jeffersonklamas/Learning_repository
/Estudo_de_Python/Exercicios-em-python/mediaaritmetica.py
926
4.4375
4
# ----------------------------------------------------- # Exercício desenvolvido por Jefferson Klamas Maarzani # Para as atividades do Curso da UFSCAR disponíveis na # Plataforma do Coursera para o curso de Introdução # da Ciência da Computação com Python # ----------------------------------------------------- # # Enu...
false
cc2900e3d4536389d9bd059d884098bc147d3e6d
jeffersonklamas/Learning_repository
/Estudo_de_Python/Exercicios-em-python/equacoesde2grau.py
888
4.125
4
#-------------------------------------------- # Cálculo de equações de segundo grau ( Bhaskara) # #-------------------------------------------- import math a = float(input("Digite um valor para A: ")) b = float(input("Digite um valor para B: ")) c = float(input("Digite um valor para C: ")) # Calculo(a, b, c) delta =...
false
d6baa2d4320f15ece2bd9d628911145a1b471105
ErenBtrk/PythonSetExercises
/Exercise7.py
237
4.375
4
''' 7. Write a Python program to create a union of sets. ''' set1 = set([1,2,3,4,5]) set2 = set([6,7,8]) set3 = set1 | set2 print(set3) #Union setx = set(["green", "blue"]) sety = set(["blue", "yellow"]) seta = setx | sety print(seta)
true
546cd33519cea7f759d09ccd11203d44fed2fc4d
sivaprasadkonduru/Python-Programs
/Sooryen_python/question3.py
608
4.125
4
''' Write a function that takes an array of strings and string length (L) as input. Filter out all the string string in the array which has length ‘L’ eg. wordsWithoutList({"a", "bb", "b", "ccc"}, 1) → {"bb", "ccc"} wordsWithoutList({"a", "bb", "b", "ccc"}, 3) → {"a", "bb", "b"} wordsWithoutList({"a", "bb", "b", "ccc"...
true
9c7c90bda0b8a79ddfd96a9805094b9748c76a07
ClassicM/Python
/Emm-4(字典).py
2,010
4.4375
4
print('dict') print('---------------------------------') #Python内置了字典:dict的支持,dict全称dictionary,在其他语言中也称为map,使用键-值(key-value)存储,具有极快的查找速度。 d = {'Amy':90,'Bob':85,'Candy':60} print(d['Amy']) d['Denny'] = 100 print(d) print('判断key是否存在,有两种方法:1.in 2.dict的get()方法') print('---------------------------------') print('Denny' in...
false
730d42ed36e3a39bf708d78324f2706e0c6a7fd0
ClassicM/Python
/Emm-13(实例属性和类属性).py
1,476
4.4375
4
#由于Python是动态语言,根据类创建的实例可以任意绑定属性。 #给实例绑定属性的方法是通过实例变量,或者通过self变量: class Student(object): def __init__(self,name): self.name = name s = Student('Bob') s.score = 90 print(s.name,s.score) class Student(object): name = 'Student' s = Student() #创建实例s print(s.name) #打印name属性,因为实例并没有name属性,所以会继续查找class的name属性...
false
205eaa9103e4985a00939e0678759d726c7d3465
farkaspeti/pair_programing
/listoverlap/listoverlap_module.py
375
4.34375
4
def listoverlap(list1, list2): list3 = [] for i in list1: if i in list2 and i not in list3: list3.append(i) else: pass print(list3) return list3 def main(): a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] li...
false
9e546395591c2f3ce35d1a9889398e7108995975
SobuleacCatalina/Rezolvarea-problemelor-IF-WHILE-FOR
/problema_8_IF_WHILE_FOR.py
656
4.1875
4
""" Se dau numerele reale pozitive a,b,c. Să se verifice dacă un triunghi ale cărui laturi au lungimile (în aceeași unitate de măsură) egale cu a,b,c. În caz afirmativ, să se determine tipul triunghiului: echilteral,isoscel,scalen. """ a=int(input("Introdu numărul a: ")) b=int(input("Introdu numărul b: ")) c=int(input...
false
c80c00855a308016585a2620659b44a93b218a07
kauboy26/PyEvaluator
/miscell.py
569
4.15625
4
def print_help(): print 'Type in any expressions or assignment statements you want.' print 'For example:' print '>> a = 1 + 1' print '2' print '>> a = a + pow(2, 2)' print '6' print '\nYou can also define your own functions, in the form' print 'def <function name>([zero or more comma s...
true
98ee6d2d5cdda315aef0cf4cb1ce9d91380fb77d
Jackiexiong/software-testing-course
/content/Intro to Python3/intro_to_python3-script.py
2,495
4.28125
4
# Intro to Python # boolean values T t True # integer values 1234 -23 0 # float values 3.14 314e-2 .1 -.1 # string values "Python's" 'she said "Python"' """String with <newline> character""" "This" "is" "one" "string" # string operators i_str = "Python" i_str[1] i_str[-1] i_str[1:3] i_str[1:7:2] i_str[7:1:-2] ...
false
76972fcaadbc52294e7e06871d1f7115e8eb6285
jabarszcz/randompasswd
/randompasswd.py
1,496
4.125
4
#!/usr/bin/env python3 import argparse import string import random # Create parser object with program description parser = argparse.ArgumentParser( description="simple script that generates a random password") # Define program arguments parser.add_argument("-a", "--lower", action='store_true', ...
true
147179c937d26d3634c92e99f5caec26ba9c4d66
madebydavid/wizzie-ctf
/lesson-05/encode.py
878
4.3125
4
#!/usr/bin/env ./../bin/python3 # Tool for hiding the password in the cheese import random cheese = [] with open('cheese.txt', 'r') as input_cheese: for line in input_cheese: line_list = list(line.rstrip()) cheese.append(line_list) password = input('Please enter the password to hide in the chees...
false
7fbee6b902a11525f9d8afd0f20a343126dd51b1
isaolmez/core_python_programming
/com/isa/python/chapter6/Tuples.py
530
4.4375
4
## Tuples are very similar to lists; but they are immutable tuple1 = (1,2,3) print tuple1 # For tuples, parantheses are redundant and this expression craetes a tuple. # For lists we must use brackets tuple2 = "a", "b", "c" print tuple2 # tuple1[1] = 99 # ERROR: We cannot mutate tuple or assign new values to its elemen...
true
916b10dc06df2fece2e1af6afe15b80696ea11cc
isaolmez/core_python_programming
/com/isa/python/chapter5/Exercise_5_11.py
468
4.1875
4
for item in range(0,21,2): print item, print for item in range(0, 21): if item % 2 == 0: print item, print for item in range(1,21,2): print item, print for item in range(0, 21): if item % 2 == 1: print item, print ## If you omit return type, it does not give warning but returns ...
true