blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
3cb0a1c8508872b40294d2a65f1fb0b704abdc93
alfreh/mi-primera-bici
/adivina_numero.py
883
3.890625
4
number_to_guess = 2 user_number = int(input("Adivina el numero: ")) if number_to_guess== user_number: print("Menuda Potra") else: print("Ni de coña, ") number_to_guess = 2 user_number = int(input("Sigue rascando: ")) if number_to_guess == user_number: print("Menuda Potra") else: print("Ni de...
9fd3bdb51590d4804d419812a901a68acd906ad6
pblvll/Coffee_Machine_2
/Problems/What day is it?/task.py
164
3.65625
4
time = int(input()) reference = 10.5 if (reference + time) < 0: print("Monday") elif (reference + time) > 24: print("Wednesday") else: print("Tuesday")
f225d41903b92b6539f9355a9464ba852ac6241c
pblvll/Coffee_Machine_2
/Problems/Keep on sailing/task.py
401
4.03125
4
# our class Ship class Ship: def __init__(self, name, capacity, city): self.name = name self.capacity = capacity self.cargo = 0 self.city = city # the old sail method that you need to rewrite def sail(self): return print("The {} has sailed for {}!".format(self.name, ...
a28553af5ad0aa6eda20aba7bcaf09fffb6b0925
Olks/MITx6.00.1x_IntroductionToCSandProgrammingUsingPython
/Queue.py
569
3.96875
4
class Queue(object): """An Queue is a list of objects""" def __init__(self): """Create an empty list""" self.objects = [] def insert(self, e): """Inserts e into self""" self.objects.append(e) def remove(self): """Removes first element from the list""" ...
f9192d47aaf79939fdfc46ef904624a4ccff1739
eamuntz/Project-Euler
/problem023.py
1,542
4
4
''' Problem 23 A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A number n is called deficient if the sum of its proper divisors is less tha...
5676d0940615be51eb22e1c525d732f764edb199
eamuntz/Project-Euler
/problem025.py
288
3.65625
4
''' Problem 25 What is the first term in the Fibonacci sequence to contain 1000 digits? ''' def fibGen(): a=1 b=2 c=0 while True: c= a+b a,b=b,c yield b fibGen=fibGen() count = 4 while True: fib = fibGen.next() if len(str(fib))>999: print count break else: count+=1
295c652e48cd661baedc8d43b61d5b8a9419b42a
eamuntz/Project-Euler
/prime.py
2,011
3.859375
4
import math import random #tools to help with questions involving prime numbers #code from other sources is noted with url's leading to source ''' http://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Primality_Testing pseudo-prime checks that should hold for numbers below When the number n to be tested ...
1af4310b3d1fd0868304e58ba0f613e1c4518f1a
fabriciohenning/aula-pec-2020
/08-1_ex01.py
495
3.8125
4
def ler_numeros(n): numeros = [] for i in range(n): numeros.append(int(input(f'Digite o {i+1}º número: '))) return numeros def main(): numeros = ler_numeros(10) print(f'Os números da lista são {numeros}.') soma = 0 mult = 1 for c in numeros: soma = soma + c...
eb6452965abbd30e508d47f7cbd1a4205fadcc6e
fabriciohenning/aula-pec-2020
/09-1_04.py
764
3.71875
4
def carrega_cidades(): resultado = [] with open('cidades.csv', 'r', encoding='utf-8') as arquivo: for linha in arquivo: uf, ibge, nome, dia, mes, pop = linha.split(';') resultado.append( (uf, int(ibge), nome, int(dia), int(mes), int(pop)) ) ...
d751374d8f906bef6832cd867362d10e66d26a14
fabriciohenning/aula-pec-2020
/05-1_ex04.py
153
3.609375
4
# Sequência de 10 em 10, até 1000 for n in range(10, 1001, 10): if n != 1000: print(n, end=', ') else: print(n, end='.')
cfe652544d5b776725be43b10cf987aef73f91c6
fabriciohenning/aula-pec-2020
/e.reforma.py
429
3.859375
4
alt = float(input('Digite a altura das paredes da sala, em metros: ')) compr = float(input('Digite o comprimento da sala, em metros: ')) larg = float(input('Digite a largura da sala, em metros: ')) print(f'A área do piso é de {compr * larg:.2f} metros quadrados.') print(f'O volume é de {alt * compr * larg:.2f} metr...
1dcf032300eca48738fc78502ca779c94e1bbd0f
fabriciohenning/aula-pec-2020
/Atividade Remota – 02-1/4. maior-numero.py
427
3.828125
4
n1 = int(input('Digite o 1º número: ')) n2 = int(input('Digite o 2º número: ')) n3 = int(input('Digite o 3º número: ')) n4 = int(input('Digite o 4º número: ')) n5 = int(input('Digite o 5º número: ')) print(f'O maior número entre eles é {max(n1, n2, n3, n4, n5)}.') print(f'O menor número entre eles é {min(n1, n2, ...
ef55a172a73edcf2fdc3d7dec4dec1105c83c7de
fabriciohenning/aula-pec-2020
/07-2_ex02.py
350
4.0625
4
# Sequência de Fibonacci com n termos num = int(input('Digite um valor maior que 2: ')) termo1 = 0 termo2 = 1 cont = 3 print(f'A sequência de Fibonacci com {num} termos é {termo1}, {termo2}', end='') while cont <= num: termo3 = termo1 + termo2 print(f', {termo3}', end='') termo1 = termo2 termo...
c8abcc93b79ab776f635fd051787fc70af79d93b
fabriciohenning/aula-pec-2020
/06-2_ex01.py
184
4.0625
4
soma = 0 while True: n = int(input('Digite um número: ')) if n != 0: soma += n if n == 0: break print(f'A soma dos números digitados é {soma}.')
a891ee5380c54a475737976341d776b9ef44e15c
ShubhamGarg01/Faulty-Calculator
/faultycalci.py
619
4.1875
4
print("enter 1st number") num1= int(input()) print("enter 2nd number") num2= int(input()) print("so what u weant" ,"+,*,/,-,%") num3= input() if num1 == 45 and num2==3 and num3== "*": print("555") elif num1 ==56 and num2==9 and num3=="+": print("77") elif num1== 56 and num2==6 and num3=="/": pr...
ec8e20416881e145b678ad339752f45538570d43
sengeiou/python
/数字/质数/所有.py
277
3.65625
4
x = 1 def main(): num = x # 质数大于 1 if num > 1: # 查看因子 for i in range(2,num): if (num % i) == 0: break else: print(num,'\n') print('') while True: main() x += 1
0da2d34f91c985c72585e201cb26b29eeb84160e
GodNarcissus/FinalProject17
/options_in_different_locations_test.py
2,226
3.75
4
import time s=0 class Character(object): def __init__(self,name,location): self.name = name self.location = location myself = Character("me" , "A") #uber = Character("Uber Driver" , myself.location) map = ["A", "B", "C"] visited = ["A"] def gps(): print("|", end=" ") for x in map: ...
b1c9434f2d4e939565f78de69d4a3774db16c67c
zotochev/VSHE
/week_06/tasks_06/06_01_list_merge2.py
453
3.703125
4
def to_sort(a, b, c): s_list = [] if len(a) != 0 and len(b) != 0: if a[-1] > b[-1]: s_list.append(a.pop()) to_sort(a, b, c) else: s_list.append(b.pop()) to_sort(a, b, c) elif len(a) == 0: s_list.extend(b) else: s_list.extend...
7f89b06b9d91d8136247fe38ad5d6877ac426e0c
zotochev/VSHE
/week 02/tasks_02/02_41_fib_num_num.py
243
3.71875
4
a = int(input()) count = 1 fib_num = 0 fib_num_2 = 0 fib_num_1 = 1 while fib_num < a: count += 1 fib_num = fib_num_1 + fib_num_2 fib_num_2 = fib_num_1 fib_num_1 = fib_num if fib_num_1 != a: print(-1) else: print(count)
cce3783549111bdc61d9b11580c52b1636c39f86
zotochev/VSHE
/week 02/tasks_02/02_20_icecreame3.py
144
3.515625
4
k = int(input()) # k = 3 m = (k % 10) + 10 if k < 10: m = k if m == 7 or m == 4 or m == 2 or m == 1: print('NO') else: print('YES')
b7323b374c21bb4430ed3b5538443bf99c402daa
zotochev/VSHE
/week 04/notes_04/notes_week_04_02.py
305
3.90625
4
# def max2 (a, b): # if a > b: # return a # else: # return b # # print(max2(2, 5)) def max2 (a, b): if a > b: return a return b # # print(max2(2, 5)) # print(max2(7, 3)) # print(max2(2, 2)) def max3 (a, b, c): return max2(max2(a, b), c) print(max3(2, 5, 3))
abfa38888111fc1fb385083c50cb5f2e01ce138f
zotochev/VSHE
/week 02/tasks_02/02_16_samenum.py
158
3.8125
4
a = int(input()) b = int(input()) c = int(input()) # a = 1 # b = 2 # c = 3 d = 0 if a == b or b == c or a == c: d = 2 if a == b == c: d = 3 print(d)
af80cbb112dec035bc2c2bcd5cfd7d520dd0a441
zotochev/VSHE
/week 02/tasks_02/02_23_matches.py
941
3.53125
4
# l1 = int(input()) # r1 = int(input()) # l2 = int(input()) # r2 = int(input()) # l3 = int(input()) # r3 = int(input()) l1 = 7 r1 = 9 l2 = 5 r2 = 11 l3 = 15 r3 = 19 answer = 0 # сортировка левых координат if l1 >= l2 and l1 >= l3: (g, k1, k2) = (l1, l2, l3) elif l2 >= l3 and l2 >= l1: (g, k1, k2) = (l2, l1, l3...
c0b5abff622feb30c68e98d76a7780d7f41ce6d4
zotochev/VSHE
/week 02/tasks_02/02_40_fib_num.py
202
3.8125
4
n = int(input()) count = 1 fib_num = 0 fib_num_2 = 0 fib_num_1 = 1 while count < n: count += 1 fib_num = fib_num_1 + fib_num_2 fib_num_2 = fib_num_1 fib_num_1 = fib_num print(fib_num_1)
f5b21b829f1ec73ef71cfe24b06106554576f0ac
zotochev/VSHE
/week 02/tasks_02/02_46_ton_line3.py
717
3.625
4
n = int(input()) n_prev = n count = 1 count_plus = 1 count_minus = 1 check_plus = 0 while n != 0: count_plus = 1 + check_plus count_minus = 1 # if n > n_prev check_plus = 0 # ввод значания n_prev = n n = int(input()) while n > n_prev and n != 0: # print('w+') count_plus += 1...
14ab832d029b836f0961f547ddd9173ce9d83119
zotochev/VSHE
/week 05/tasks_05/05_10_fac.py
110
3.53125
4
n = int(input()) # n = 5 count = 1 le = 0 for x in range(1, n + 1): count *= x le += count print(le)
c4f2ea03be514143bbc8425d4e2d7c8feb244df2
zotochev/VSHE
/week 05/tasks_05/05_05_flag.py
701
3.609375
4
n = int(input()) # n = 5 my_flag = [('+___ '), ('|', ' / '), ('|__\ '), ('| ')] # print(range(1, n)) for i in range(0, 4): if i != 1: for j in range(0, n): print(*my_flag[i], sep='', end='') else: for j in range(0, n): print(*my_flag[i][0], j + 1, my_flag[i][1], sep='...
a24d97dfc86481d4c1b1efe5dfa596521ab2868d
zotochev/VSHE
/week 02/notes_02/notes_week_02_08_continue.py
202
3.8125
4
now = int(input()) sum_seq = now while now != 0: now = int(input()) sum_seq += now print(sum_seq) now = int(input()) while now != 0: if now > 0: print(now) now = int(input())
682ea5cc15860f84a416469dbefa81c3d60ba54e
DariaMinieieva/sudoku_project
/crossword/crossword_backtracking/backtracking.py
5,176
4.09375
4
"""This module implements backtracking algorithm to solve crossword.""" class CrosswordSolver: """Class for crossword solving representation.""" def __init__(self, matrix: 'Array2D', words=None): """Creates a new crossword solver.""" self.matrix = matrix self.num_rows = self.matrix.nu...
7aadcf9b4d857e5ec2481a2d940eb797245ace3c
Heilmittel/Himmel
/Python27/2016/03.py
335
4
4
import random number = random.randint(1,55) guess = int(raw_input("Enter an integer:")) if guess == number : print "Congratulations,you guessed it." print "(But you do not win any prize!)" elif guess < number : print "No,it is a little higher than that." else : print "No,it is a little lower than that."...
6304a7d474fa930d66888b031b2a07d21012b678
YChanHuang/Learn_Python
/py4e_note.py
396
3.859375
4
x = list() x.append('1') dir(x) print(x) # split() function string.split() # split a string into a list default on space test_string = ' abc, so abc.split, and this returns a list' test_list = test_string.split() # test string as following example # ['abc,', 'so', 'abc.split,', 'and', 'this', ...
047a5ee66cbf8c42a7677535ccbab44b5345f190
medishettyabhishek/Abhishek
/Abhishek/Section 9/Section 9-1/Star meta Charcater.py
148
3.65625
4
#* is the important star metacharacter import re pattern = r"bread(eggs)*bread" if re.match(pattern ,"breadeggsbread"): print("macth found")
9abdcd0a0ffb12c4a719f24c355029ca504e03df
medishettyabhishek/Abhishek
/Abhishek/Section 9/Section 9-1/Regular Expression.py
195
4.125
4
import re pattern = r"eggs" if re.findall(pattern,"baconeggseggseggsbacon"): print("match found") else: print("match not found") print(re.findall(pattern,"baconeggseggseggsbacon"))
881d4baaeb0e626ca7607dd0ed38fd7e2cb93035
ss6231/pyGames
/calendarApp.py
3,841
4.5
4
# Asks user to enter date while program outputs whether that day is a holiday or a regular working day. month = int(input("Enter an month as an integer from 1-12: ")) # input month if (month>12) or (0>=month): # only 12 months print ("Invalid input. Months are numbered from 1 to 12") else: date = int(input("En...
59edb404aaa2da4d555033041c589bcdcf390a90
JazzyJas0911/IEEE754_FloatingPoint
/Assn13.py
2,161
3.9375
4
import struct def convertFloat (number): #using the struct library interpret a string as packed binary data. allowing me to manipulate the bits num = struct.unpack('I', struct.pack('f', number))[0] #gets sign bit 31 signBit = (num & 0x80000000) >> 31 #gets exponent bits 30-23 ...
3039f34b6133a21332e579974006582c13942aa4
christopherwj/compe560
/testTwo/shortest_distance_dij.py
1,539
3.953125
4
from queue import PriorityQueue class Graph: def __init__(self, num_of_vertices): self.v = num_of_vertices self.edges = [[-1 for i in range(num_of_vertices)] for j in range(num_of_vertices)] self.visited = [] def add_edge(self, u, v, weight): self.edges[u][v] = weight s...
999b197b98ada31bd27936eb2cc4f71dcee49113
heyhello89/openbigdata
/03_Data Science/1. Collection/1. CSV Handle/csv_practice.py
4,817
3.515625
4
import csv, math def get_cvs_colInstance(access_key): col_instance=[] col_index=data[0].index(access_key) for row in data[1:]: col_instance.append(row[col_index]) return col_instance def type(access_key): # 예외처리를 통하여 보다 범용적으로 바꿔볼것 if access_key[0:5]=='COUNT': type='int' elif a...
e8b87943e39a6d8d62ec64f517517612b49ab321
heyhello89/openbigdata
/01_jumptopy/chap05/practice/sum_except.py
587
3.6875
4
def sum(a, b): return print(a+b) while True: num=input("안녕하세요 두 수를 입력하세요. (종료: 프로그램 종료) : ") if num=="종료": break try: a=int(num.split()[0]) except ValueError: a=num.split()[0] a=int(input("죄송합니다. 첫번째 입력이 [%s]입니다. 숫자를 입력하세요. : "%a)) try: b=int(num.split()[...
7722ba989d25df43052f42321b6c7062c62398af
heyhello89/openbigdata
/01_jumptopy/chap04/practice/visitor_2.py
730
3.71875
4
name=input("이름을 입력하세요.: ") a=1 f=open('방명록.txt', 'r', encoding='UTF8') visitor = f.readlines() def insert_birth(a): if a==1: birth = input("생년월일을 입력하세요 (예:801212):") print(name + "님 환영합니다. 아래 내용을 입력하셨습니다.\n" + name + " " + birth) with open('방명록.txt', 'a', encoding='UTF8') as f: ...
95f50ba39e115aa3a9b208267e25f8604ba931ad
heyhello89/openbigdata
/01_jumptopy/chap05/230_try_except_type3.py
498
3.703125
4
num1, num2 = input("두개의 숫자를 입력하세요.").split() is_calculate=True try: f = open('나없는 파일','r') result = int(num1)/int(num2) except FileNotFoundError: print("파일이존재하지 않습니다.") print("System Error Message"+str(e)) is_calculate=False except ZeroDivisionError: print("연산을 할 수 없습니다.") print("System E...
fdc377bf57149c28f1d45c59462c368a748222b9
heyhello89/openbigdata
/01_jumptopy/chap02/True_False_type.py
983
4.03125
4
# coding: cp949 my_str="̽" # my_str=" " my_list=[1,2,3] # my_list=[] my_tuple=(1,2,3) # my_tuple=() my_dic={"߹̾":"Ҿ ִ","ö":"ٸ ̷"} # my_dic={} my_num=100 # my_num=0 print("1] ڿ(String) Ÿ True/False") if my_str: print("True") else: print("False") print("\n2] Ʈ(List) Ÿ True/False") print("my_list: ",end='') pri...
2e11462c1860ae4958eda578555663d5e4ae1d52
heyhello89/openbigdata
/01_jumptopy/chap06/practice/2_multiple.py
1,360
3.890625
4
def print_num(ans): for i in ans: if i==ans[-1]: print(str(i)+" ",end="") else: print(str(i)+", ",end="") def multiple(a, b): ans=[] for count in range(1, (int(a)//int(b))+1): result=int(b)*count ans.append(result) return ans def set_mul(a, b, c)...
2e1785ec7697bba4c1b0711bb9cca8fa0138aa9d
heyhello89/openbigdata
/01_jumptopy/chap04/142.py
391
3.8125
4
def my_sum(num1,num2): print("덧셈 연산") internal_result = num1 + num2 if internal_result > 0: print("연산 결과가 양수로 분석됩니다.") elif internal_result ==0: print("연산 결과가 양수로 분석됩니다.") else: return num1+num2 result=my_sum(1,2) print("최종 연산 결과: ",result) print("계산기 ver1.0 종료")
a8e03c84a5af22a421a2d5cc320eb101ef3cd178
heyhello89/openbigdata
/01_jumptopy/chap04/147_sum_many.py
177
3.609375
4
def sum_many(*args): sum=0 for i in args: sum=sum+i return sum result = sum_many(1,2,3) print(result) result=sum_many(1,2,3,4,5,6,7,8,9,10) print(result)
ca8c9a39cf2df9cdf9818c9842eaed27eb4f352b
lilia-k/Project
/toyrobot.py
2,920
3.953125
4
############## # Created on 12/12/2017 # Version 001: Modified on 12/12/2017 by xxxxx # This is an application which enables the movement of a toy robot based on a set of action commands # These action commands are contained in a file, and should be placed in the folder C:\Python\input.txt ############### # Lis...
272e273e15b0df254e2ab8295924c6ed091eb894
ian-gallmeister/python_utils
/append_to_file.py
1,319
3.5
4
#!/usr/bin/env python #Assumed encoding is utf-8 #If text uses a different one, please specify #encode -> bytes #decode -> specified encoding import sys #python2 - turn into bytes, write #python3 - write as encoding def append_to_file( name, text, encoding='utf-8' ): version = sys.version_info[0] if version == 2 ...
2d366a66a851d016563b27ffbddfd1f0a3d753ae
ajit116/DrAiveX
/excel_Pandas.py
1,420
3.6875
4
import pandas as pd import excel var1=pd.read_excel("C:\\Users\\DELL\\Desktop\\dataset.xlsx",0) var2=pd.read_excel("C:\\Users\\DELL\\Desktop\\dataset.xlsx",0) CE_ME=0 #Number of civil and mechanical students l1=var1.describe() l2=var2.describe() req=0 #var1 is the original sheet and var2 is the final sheet ...
9c2085df70fce10bc3d049be9a8b7c6b5169fcf5
jaebooker/2C-2S
/challenge/three.py
2,064
4
4
from two import * """place everything in iterable sets, check if already visted, traversing call recursively, getting as far away from node before visting""" def dfs_r(nodes, node, visited=None): if visited == None: visited = set() visited.add(node) for i in nodes.node_dict[node] - visited:...
b702815ac61cc728566eba1e4c1463e0fcec3143
KenMunk/csc131-hw3
/code/participants.py
506
3.828125
4
# Welcome to Coding using Git! We all have to edit this same file. # Update the students list with your name in alphabetical order by first name. # Example: students = ['Fiz Ban', 'Foo bar'] students = [] professor = ['Gary Kane'] course = ['CSC 131'] print("%s's %s is the best!" % (professor[0], course[0])) print("S...
972787571305981557fa4a34a38ee9b9d3f9da40
pubudu08/algorithms
/security/salt_hashing_passwords.py
1,191
3.90625
4
import uuid, hashlib """ you can get slightly more efficient storage in your database by storing the salt and hashed password as raw bytes rather than hex strings. To do so, replace hex with bytes and hexdigest with digest. how do you reverse it to get the password back? You don't reverse it, you never reverse ...
f47f382687ee2b7da8147a7a4423cbc8180dbebd
misrayazgan/METU-CENG-Coursework
/Ceng435 - Data Communications and Networking/Term Project - Part1/b.py
1,980
3.5
4
ip = "10.10.1.2" # ip address of the b-interface for receiving a message from s ip_r1 = "10.10.2.2" # ip address of the next hop(r1) ip_r2 = "10.10.4.2" # ip address of the next hop(r2) port = 12346 chunk_size = 39 # To send the messages in chunks of 39 bytes import socket import threadi...
03d9fdd8afb04824150ea95bd1d913de71b0609e
ttopac/AeroSandbox
/aerosandbox/tools/string_formatting.py
1,515
3.671875
4
import math import aerosandbox.numpy as np import hashlib def eng_string(x: float, format='%.3g', si=True): ''' Taken from: https://stackoverflow.com/questions/17973278/python-decimal-engineering-notation-for-mili-10e-3-and-micro-10e-6/40691220 Returns float/int value <x> formatted in a simplified engine...
1242ada6bfcdafe60fb55fba6777a93a75019bb6
gustavomello9600/projeto_euler
/python/problem10.py
423
3.6875
4
from itertools import cycle relevant_primes = [3, 7, 11, 13, 17, 19] def is_prime(n): for p in relevant_primes: if n % p == 0: return False return True p = 21 steps = cycle([2, 4, 2, 2]) soma = sum(relevant_primes) + 7 while p < 2_000_000: if is_prime(p): relevant_primes.ap...
576beb85deb3f37430eb6da9b57d8908ef157fe2
theDreamer911/10dayspython
/VI/handle.py
306
4.09375
4
try: age = int(input('Age: ')) if age > 1: print(f"You are {age} years old") elif age == 1 or age == 0: print(f"You are {age} year old") else: print(f"You input {age}, age invalid") except ValueError: print('You put an invalid age') print('Execution continues')
fa3c3d50712dc715eed01d03362ba25b3fab2e3f
theDreamer911/10dayspython
/VI/app.py
194
3.890625
4
age = int(input('Age: ')) numbers = [*range(18, 40, 2)] if age in numbers: print(f"Your age is {age}, you're allowed here") else: print(f"Your age is {age}, you're not allowed here")
eb2686085823bbf3612d49155cb69de2fc37e6f8
theDreamer911/10dayspython
/VII/properties.py
776
3.859375
4
# class Product: # def __init__(self, price): # # self.set_price(price) # self.price = price # @property # def price(self): # return self.__price # # @price.setter # # def price(self, value): # # if value < 0: # # raise ValueError('Price cannot be negati...
efd0231107a64e5e0b75741280c1f5682f8fc190
theDreamer911/10dayspython
/VIII/regex.py
411
3.921875
4
import re TraceStudent = ''' Agung is 175cm and Adenta is 171cm Aljevon is 172cm and Agra is 165cm ''' tall = re.findall(r'\d{1,3}', TraceStudent) # d{1,3} mengambil 3 angka names = re.findall(r'[A-Z][a-z]*', TraceStudent) # [A-Z][a-z] mengambil karakter yang mengandung huruf besar dan kecil tallDict = {} x...
61d6a9cd835dbd3b99d9df77476f44a6f674d19d
Lotoh/The-Lost-Forest
/menu.py
4,353
3.640625
4
import world import sys import setup import os import colour from tkinter import * root = Tk() Console = Text(root) Console.pack() def write(*message, end = "\n", sep = " "): text = "" for item in message: text += "{}".format(item) text += sep text += end Console.ins...
2a193af76f5592ed5ebd8811fd5bb71b28ff23e4
chrngb/Machine-Learning
/Polynomial Regression/PoR.py
1,018
3.71875
4
#Polynomial Regression import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression data = pd.read_csv(r"C:\Users\Rising IT\PycharmProjects\Pos_Salaries.csv") #print(data) x = data.iloc[:,1:2].values #if only 1 ...
421a3a05798ec7bfdfd104994e220ffb9f2613f7
Tornike-Skhulukhia/IBSU_Masters_Files
/code_files/__PYTHON__/lecture_2/two.py
1,401
4.1875
4
def are_on_same_side(check_p_1, check_p_2, point_1, point_2): ''' returns True, if check points are on the same side of a line formed by connecting point_1 and point_2 arguments: 1. check_p_1 - tuple with x and y coordinates of check point 1 2. check_p_2 - tuple with x and y coor...
a56844b77ebb2b8dba937e215097e2f72aae59a3
JChen1717/ud120-projects
/datasets_questions/explore_enron_data.py
3,804
3.703125
4
#!/usr/bin/python3 """ Starter code for exploring the Enron dataset (emails + finances); loads up the dataset (pickled dict of dicts). The dataset has the form: enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict } {features_dict} is a dictionary of features associated with that pers...
f6e94ae84231ee30eebb8171cd4bae538515652b
diesgaro/holbertonschool-web_back_end
/0x00-python_variable_annotations/6-sum_mixed_list.py
379
3.84375
4
#!/usr/bin/env python3 ''' 6. Complex types - mixed list ''' from typing import List, Union def sum_mixed_list(mxd_lst: List[Union[int, float]]) -> float: ''' Function that sum mixed list Arguments: mxd_lst (List): A List with float and integer values Return: ...
fc3f2c70558cac7bba02a2ae4443608744cd463a
diesgaro/holbertonschool-web_back_end
/0x02-python_async_comprehension/1-async_comprehension.py
394
3.515625
4
#!/usr/bin/env python3 ''' 1. Async Comprehensions ''' import asyncio import random from typing import List async_generator = __import__("0-async_generator").async_generator async def async_comprehension() -> List[float]: ''' Coroutine that will collect 10 random numbers using an async comprehensing ove...
424668ef3077df50ba211f166a3c00980fb7d4a4
matheuszei/Python_DesafiosCursoemvideo
/0068_desafio.py
1,194
4.0625
4
#Faça um programa que jogue par ou ímpar com o computador. # O jogo só será interrompido quando o jogador perder, mostrando o total de vitórias consecutivas # que ele conquistou no final do jogo. import random win = 0 print('=-' * 15) print('VAMOS JOGAR PAR OU ÍMPAR') print('=-' * 15) while True: v = int...
4e6f19c0decd6743ac9219d6084d8f66e17f47ec
matheuszei/Python_DesafiosCursoemvideo
/0078_desafio.py
730
3.875
4
#Faça um programa que leia 5 valores numéricos e guarde-os em uma lista. #No final, mostre qual foi o maior e o menor valor digitados e as suas respectivas posições na lista. valores = [] maior = menor = 0 for c in range(0, 5): valores.append(int(input(f'({c}) Digite um valor: '))) maior = max(valores) men...
d30db0f82f5497eb7a95916e8868f4ce4107325d
matheuszei/Python_DesafiosCursoemvideo
/0046_desafio.py
185
3.578125
4
#Crie um programa que faça o computador jogar Jokenpô com você. from time import sleep for c in range(10, -1, -1): print(c) sleep(1) print('FELIZ ANO NOVOOOOOO!!!!!!')
70b1c146606022a6a3c9abf15e3aee2b7b760e30
matheuszei/Python_DesafiosCursoemvideo
/0044_desafio.py
1,191
3.859375
4
#Elabore um programa que calcule o valor a ser pago por um produto, # considerando o seu preço normal e condição de pagamento: # à vista dinheiro/cheque: 10% de desconto # à vista no cartão: 5% de desconto # em até 2x no cartão: preço formal # 3x ou mais no cartão: 20% de juros preco = float(input('Informe o pr...
4cd244592bd39514d627fd2eea224af3edd60a48
matheuszei/Python_DesafiosCursoemvideo
/0014_desafio.py
231
4.34375
4
#Escreva um programa que converta uma temperatura digitada em °C e converta para °F. c = float(input('Informe a temperatura em C: ')) f = (c * 1.80) + 32 print('A temperatura de {}°C corresponde a {:.1}°F!'.format(c, f))
7a778a84ca61b99672feeeeeacebf287b5a84122
matheuszei/Python_DesafiosCursoemvideo
/0031_desafio.py
418
3.953125
4
#Desenvolva um programa que pergunte a distância de uma viagem em Km. # Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 # parta viagens mais longas. km = int(input('Digite a distância da viagem: ')) preco = 0 if km < 200: preco = km * 0.50 else: preco = km * 0.45...
9469f6954e175e0cb02f09cc77161e44eb046a15
matheuszei/Python_DesafiosCursoemvideo
/0025_desafio.py
188
4.03125
4
#Crie um programa que leia o nome de uma pessoa e diga se ela tem "SILVA" no nome. nome = input('Digite um nome: ') print('A pessoa possui SILVA? {}'.format('Silva' in nome.upper()))
3862cdfa0ba22cebb714557f79b764ff512d90e0
matheuszei/Python_DesafiosCursoemvideo
/0006_desafio.py
288
3.9375
4
#Crie um algoritmo que leia um número e mostre o seu dobro, tripo e raiz quadrada. n1 = int(input('Digite o valor de N1: ')) print('O dobro de N1 é igual a {} \nO triplo de N1 é igual a {}'.format(n1 * 2, n1 * 3)) print('A raiz quadrada de N1 é igual a {}'.format(n1**(1/2)))
dd7d5203f18be05982adc9b1cd3f5ab72bd7c23a
matheuszei/Python_DesafiosCursoemvideo
/0007_desafio.py
238
4.09375
4
#Desenvolva um programa que leia as duas notas de um aluno, e calcule e mostre a sua média nota1 = int(input('Digite a sua NOTA 1: ')) nota2 = int(input('Digite a sua NOTA 2: ')) print('Média final: {}'.format((nota1 + nota2) / 2))
c958cb5a82f6c8104bc7e0444032862e11459094
matheuszei/Python_DesafiosCursoemvideo
/0050_desafio.py
323
3.84375
4
#Desenvolva um programa que leia seis números inteiros e mostre a soma apenas daqueles # que forem pares. Se o valor digitado for ímpar, desconsidere-o. soma = 0 for c in range(0, 6): n = int(input('({}) Digite um valor: '.format(c))) if n % 2 == 0: soma += n print('Soma total: {}'.format(soma)) ...
ea4ddee2e65ca23a0797ebe195850eb412074168
kosamati/pythoncw
/cw2/zadanie.py
420
3.578125
4
class animal: def __init__(self, n, t, c): self.name = n self.type = t self.color = c def eat(self): print(f'{self.type} {self.name} zjadł obiad') def move(self): print(f'{self.type} {self.name} zmienił położenie') if __name__ == "__main__": cat1 = animal("Pusia...
75bbe2ec9d613543d12e963a3c16a90c9a9eb09f
racine101/palindrome_question
/palindrome.py
487
3.71875
4
def isValidChar(c): return c.isalpha() def isPalindrome(S): start =0 end = len(S)-1 while start < end: c1 = S[start].lower() c2 = S[end].lower() if isValidChar(c1) and isValidChar(c2): if c1 != c2: return False start += 1 end ...
dbf1b74b7b31ff3fd949142bd9c53ef74c38f34f
yangjingfeng/python-note
/test/day2/2.py
90
3.671875
4
while True: for i in range(5): print(i) if i == 3: exit(3)
35c5023e9e1a88f32a4787c098137996f73fc368
ramda-phi/PyPrac
/Queue.py
783
3.6875
4
class Queue: class Cell: def __init__(self, data, link=None): self.data = data self.link = link def __init__(self): self.size = 0 self.front = None self.rear = None def enqueue(self, x): if self.size == 0: self.front = self.rear =...
b1c95880af1365ab630544adc2eb774a7b2ea2c0
ramda-phi/PyPrac
/test_Set.py
329
3.5
4
import Set s = Set a = s.Set([1, 2, 3, 4, 5]) b = s.Set([4, 5, 6, 7, 8]) print a print b c = a.union(b) print c d = a.intersection(b) print d e = a.difference(b) print e print a.issubset(c) print c.issubset(a) print a.isequal(a) a.insert(1) print a a.insert(10) print a b.remove(5) print b print c print '-----' f = b....
95f4a8102e352f350d08b93f4bfe31f421d8ee0d
ramda-phi/PyPrac
/Deque.py
2,083
3.84375
4
# Double ended queue class Deque: # define Cell class Cell2: def __init__(self, x, y=None, z=None): self.data = x self.next = y self.prev = z def __init__(self): head = Deque.Cell2(None) # header head.next = head # circular linked list ...
a1ce03551a3b1839cb451e637937175def056737
marcgrant21/Client_and_Server_Python
/vote_server.py
4,095
3.578125
4
# Server to implement simple program to get votes tallied from two different # clients. The server will wait until two different clients connect, before # sending a message down to each client. # Author: Marc Grant 2019-09-26 # Version: 0.1 #!/usr/bin/python3 import random import string import socket import sys def...
58dce10e602f32b280194b1d66c08e3d36a786b4
sjhonatan/introPython
/20-class/00-classes.py
480
3.8125
4
""" Jhonatan da Silva Last Updated version : Tue Jan 31 22:35:52 2017 Number of code lines: 19 """ # First we initiate the class class Functions(): def __init__(self): self.numFunctions = 3 def firstFunction(self): print("I'm in the first function") def secondFunction(self): print...
e71d9a91ed72bfa8ae16bdda03fccacfd7e80583
iyee20/FinalProject18
/projectcode.py
55,762
3.546875
4
#the game is heavily based on Fire Emblem Heroes, the mobile game of the Fire Emblem series import random #import random to use import sys, pygame #import pygame and sys to use pygame.font.init() #initialize font module so font functions work size = width, height = 500, 500 #define size as a certain px area screen = p...
00d29dce519eade07f3269e7eb83ddc4426721eb
XinchaoGou/MyLeetCode
/283. Move Zeros.py
831
3.609375
4
from typing import List class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ k = 0 cnt = 0 length = len(nums) for i in range(length): if nums[i] != 0: nums[k] =...
6f4519015aea40f4bd3cc64bd22d8e5b8e02d238
XinchaoGou/MyLeetCode
/102. Binary Tree Level Order Traversal.py
825
3.515625
4
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: if not root: return [] cur_layer = [root] res = [] while cu...
68bbf7f74f4783f7ce0de2f80e3b61f364082057
XinchaoGou/MyLeetCode
/654. Maximum Binary Tree.py
1,137
3.515625
4
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode: def dfs(left, right): if left > right or left <0 or right>len(nums)-1: ...
9c62ed0761e46b3afed7b1493f6c915019fb4df3
XinchaoGou/MyLeetCode
/116. Populating Next Right Pointers in Each Node.py
700
3.9375
4
class Solution: def connect(self, root: 'Node') -> 'Node': if not root: return root # 从根节点开始 leftmost = root while leftmost.left: # 遍历这一层节点组织成的链表,为下一层的节点更新 next 指针 head = leftmost while head: # CONNECTION 1 ...
19ff9bc8c6cc955f306cfee5142a8cbcc6dbc75d
XinchaoGou/MyLeetCode
/169. Majority Element.py
927
3.5625
4
from typing import List class Solution: # def majorityElement(self, nums: List[int]) -> int: # length = len(nums) # half_len = length//2 # # l_me = self.majorityElement(nums[:half_len]) # # r_me = self.majorityElement(nums[half_len:]) # num_dict = {} # maj_ele = nums[...
b1b4fb1cf58cc7559993ef272e554218a468d118
XinchaoGou/MyLeetCode
/217. Contains Duplicate.py
237
3.6875
4
from typing import List class Solution: def containsDuplicate(self, nums: List[int]) -> bool: l1 = len(nums) l2 = len(set(nums)) return not l1 == l2 input = [1,2,3] print(Solution().containsDuplicate(input))
26f3b93307fa96e97f6df8c0e492a58fbe16b028
XinchaoGou/MyLeetCode
/167. Two Sum II - Input array is sorted.py
1,351
3.578125
4
from typing import List class Solution: # def twoSum(self, numbers: List[int], target: int) -> List[int]: # def search_helper(l, t: int): # r = len(numbers) - 1 # while (l <= r): # mid = int(l + (r - l) / 2) # mid_val = numbers[mid] # ...
952e289c81f0cfb51890177403e90f75cd1dfdd1
XinchaoGou/MyLeetCode
/61. Rotate List.py
573
3.6875
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def rotateRight(self, head: ListNode, k: int) -> ListNode: if not (head and head.next and k) : return head fast = head cnt = 1 whi...
11a7aad67da703d501dfc08e7fb3481fcf58317c
XinchaoGou/MyLeetCode
/56. Merge Intervals.py
512
3.59375
4
from typing import List class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: if not intervals: return [] sorted_intervals = sorted(intervals, key=lambda x: x[0]) res = [sorted_intervals[0]] for i in range(1, len(sorted_intervals)): l...
9cce47566dda73cb3987370a9dc6007e2dd2ec87
XinchaoGou/MyLeetCode
/23. Merge k Sorted Lists.py
2,187
3.765625
4
from typing import List import heapq class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next # 顺序合并 class Solution: def mergeKLists(self, lists: List[ListNode]) -> ListNode: def merge2Lists(a, b): if not a or not b: return a or b ...
6812bae562d763adea7d6d83b81c11aeaf6b149e
rohan1218/code
/greatest.py
189
3.921875
4
a=int(input()) b=int(input()) c=int(input()) def greatest(a,b,c): if a>=b and a>=c: print(a) elif b>=a and b>=c: print(b) else: print(c) greatest(a,b,c)
a10d9793d9d91e801f2327cc19ea8dea2f93600d
MrPratik07/Amazon-Dataset
/amazon_dataset.py
4,501
3.75
4
#!/usr/bin/env python # coding: utf-8 # # Jobs available in Banglore and Seattle # In[4]: import csv count1=0 count2=0 with open('Datasets/amazon_jobs_dataset.csv','r',encoding="utf8") as file_obj: file_data=csv.reader(file_obj,skipinitialspace=True) file_list=list(file_data) location=[] for row in file_lis...
292a9fcfaafd9bf4242e7361e1a14186a445e3be
adityamon11/Python-Assignment-5
/Assignment5_1.py
183
3.703125
4
def main(): x = int(input("Enter a number")); pattern(x); def pattern(x): if(x>0): print("*",end = " "); x= x-1 pattern(x); if __name__ == '__main__': main();
d5567719ef9ffab667950a2aae828f15e31173a8
hajikasasar/ProgrammingClass
/tugas_1.py
327
3.578125
4
A = int(input("Masukan Nilai pertama = ")) B = int(input("Masukan Nilai kedua = ")) C = int(input("Masukan Nilai ketiga = ")) D = A + B + C E = A - B - C F = A * B * C G = A //B // C print(" %d + %d + %d = "%(A,B,C),D) print(" %d - %d - %d = "%(A,B,C),E) print(" %d x %d x %d = "%(A,B,C),F) print(" %d / %d / %d = "%(A,...
6a179ed75e88b38240b9e613989f4aa419189f77
xellmann/SN_WD21_lektion-11-python-datenstrukturen
/guess_game_list.py
1,028
3.734375
4
import random import json secret = random.randint(1, 30) count = 0 low_score = 0 with open("score.json", "r") as score: score_list = json.loads(score.read()) score_list.sort() out_list = "" for x in range(len(score_list)): out_list = out_list + str(score_list[x]) if x != len(score_list...
2a6b2f58988d3c4ed1833af008701244d218fd00
Joseph-Antoun/Basic-ML
/src/Pr1.py
4,976
3.609375
4
import numpy as np class LogisticRegression: def __init__(self, X, y, x_labels, y_label, alpha=1, num_iters=100, stopping_criteria=1e-50): """ Constructor for the logistic regression class :param X: the features data used for train :param y: the classification data used...
0fdc190bda0f1af4caf7354f380ce94134c70c78
cizamihigo/guess_game_Python
/GuessTheGame.py
2,703
4.21875
4
print("Welcome To Guess: The Game") print("You can guess which word is that one: ") def check_guess(guess, answer): global score Still = True attempt = 0 var = 2 global NuQuest while Still and attempt < 3 : if guess.lower() == answer.lower() : print("\nCorrect Answer " + ans...
ea51e701d670bd2039b3a5d624baa7f93852eaf2
it3s/mootiro_form
/src/mootiro_form/utils/text.py
389
3.59375
4
# -*- coding: utf-8 -*- from __future__ import unicode_literals # unicode by default import random def random_word(length, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ' \ 'abcdefghijklmnopqrstuvwxyz' \ '0123456789'): '''Returns a random string of some `length`.''...