blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
f3665fbcac0c5cb8c6ff1f7158a1a6d993fc5233
TWICE9/prog_pracs
/prac_01/broken_score_thingo.py
385
3.671875
4
""" CP1404/CP5632 - Practical Broken program to determine score status """ # TODO: Fix this! def main(): score_one = int(input("enter your score: ")) if score_one in range(50, 90): print("Passable.") elif score_one in range(90, 101): print("Excellent!") elif score_one < 50: pr...
e1bb561b6d0a437844bd50e48952b372acfe801a
masasa/pyapps
/om-quad-equt.py
1,796
4.46875
4
#!/usr/bin/python import math import argparse def main(): """ This function computes the quadratic equation solution of the quadratic equation enetred by the user decribing the parameters of Ax^2 + Bx + C (which are A, B and C) """ # parsing user arguments input parser = argparse.Argument...
85179c3020461b48e2f579322a3d09b65ad55453
rushil-b12/funcnotes
/filtering.py
935
3.796875
4
# PRIME NUMBERS def is_prime(x): for i in range(2, x//2 + 1): if x % i == 0: return False return True prime = [] # for i in range(2, 101): # if is_prime(i): # prime.append(i) prime = [i for i in range(2, 101) if is_prime(i)] prime_filtered = list(filter(is_prime, range...
417612cad26cda5c4e2a5cea596a9229cecaee4e
gzanon/exerciciosPython3
/Exercício 006 – Dobro, Triplo, Raiz Quadrada.py
190
4.03125
4
print('====== DESAFIO 006 ======') s = float(input('Digite um número: ')) print('O número é {}, seu dobro é {}, seu triplo é {} e sua raiz quadrada é {}'.format(s, s*2, s*3, s**(1/2)))
19d0aaebae66c257a99de45b9c103900e6b6978d
gzanon/exerciciosPython3
/Exercício 017 – Catetos e Hipotenusa.py
426
3.96875
4
''' from math import sqrt co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Comprimento do cateto adjacente: ')) hip = sqrt(pow(co, 2) + pow(ca, 2)) print('A hipotenusa vai medir {:.2f}'.format(hip)) ''' from math import hypot co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Co...
b7184c908e86a27c914e36cf7dad777b8bcfe3ad
gzanon/exerciciosPython3
/Exercício 035 – Analisando Triângulo v1.0.py
386
4.03125
4
print('====== DESAFIO 035 ======') print('Verifique se os valores formam um triângulo.') a = float(input('Primeiro segmento: ')) b = float(input('Segundo segmento: ')) c = float(input('Terceiro segmento: ')) if a < b + c and b < a + c and c < a + b: print('Os seguimentos acima podem formar um triângulo.') else: ...
afa472f9cf7cd07eec555710250fbbf96292540e
rainly/coin2021
/Code/Function.py
5,988
3.71875
4
""" 邢不行2021策略分享会 币安期现套利程序 邢不行微信:xbx3636 """ import pandas as pd import time pd.set_option('expand_frame_repr', False) # 当列太多时不换行 pd.set_option("display.max_rows", 500) # 在币币账户下单 def binance_spot_place_order(exchange, symbol, long_or_short, price, amount): """ :param exchange: ccxt交易所 :param symbol: 币币交...
43cbfdfbcf06ac6357a287bc93035b4c96c6f555
vyshakrameshk/EDUYEAR-PYTHON---20
/Day6-assignment.py
2,114
4.1875
4
# print("om namah shivaya !") # print("Hello World !") # Day 6. # Common part -> Create a list of n numbers num = int(input("What is the list size you want?")) user_list = [ ] # print(dir(user_list)) for i in range(num): user_list.insert( i , int( input("enter the {} element of the list:".format(i+1...
851cbe1b636189177f0c16a8fdf4d18f90f0f069
vyshakrameshk/EDUYEAR-PYTHON---20
/Question2 - 13_06_2021.py
514
4.3125
4
# Write a Python program that accepts a string and calculate the # number of digits and letters. # Sample Data : Python 3.9 # Expected Output : # Letters 6 # Digits 2 # print(dir(str)) string = input("Enter a String:\n") digit_count = 0 letter_count = 0 other_conut = 0 for i in string: if i.isalpha()...
306d95a89b96ad986e518ea2d753880d2b189851
vyshakrameshk/EDUYEAR-PYTHON---20
/Day9-assignment.py
1,746
4.40625
4
# print("om namah shivaya !") # print("Hello World !") # Day 9 : # 1. Take a number from user and check whether it is prime or not. # Use parameters to send the number to function. # Eg. Enter a number 3 # 3 is prime # def prime_num( num ): # if num>=2: # for i in range(2,num): # if nu...
010e8a60b8fc3c53ace976845f3ac572ce1da262
zyy0721/pyBlur
/test3_Oxyry.py
680
3.640625
4
import random def getArray (): return list (random .random ()*100 for OOOOO0O00OO0OOO00 in xrange (20 )) def bubbleSort (OOO00O0O0O00O0O00 ): OO00000O000O0OO00 =len (OOO00O0O0O00O0O00 ) for OOOOOOO00OOO00OO0 in range (OO00000O000O0OO00 ): for OO0O000OOO0O0OOO0 in range (0 ,OO00000O000O0OO00 -OOOOOOO...
99a6f16b00cefcd22ac5a0d24538b1b16e86a567
Aborigenius/python
/Functions/stringDecorator.py
311
3.65625
4
# -*- coding: utf-8 -*- """ Created on Thu Jan 16 15:19:46 2020 @author: spiridiv """ def decorFunc(func): def innerFunc(n): result = func(n) result += " ,How are you?" return result return innerFunc @decorFunc def hello(name): return "Hello "+name print(hello("Pesho"))
97220aec6824a879513390af6ffb91429f2dd7eb
Aborigenius/python
/Basics/rangetype.py
392
4.375
4
# -*- coding: utf-8 -*- """ Created on Tue Jan 14 12:11:07 2020 @author: spiridiv Range - Created with range(5) - if single value it starts from 0 and ends with at the provided value. If two values are provided it starts with the first and at the last range(4,10). Can have steps, for example range(1,15,3) will be 1,4...
286b1d488bc193465a685185b227f4f4d23df439
Aborigenius/python
/Loops/IOFunctionsAssignment.py
261
4.09375
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 15 14:49:40 2020 @author: spiridiv """ import sympy num=int(input("Please enter a number:")) if (sympy.isprime(num) == True): print("Number %i is Prime"%(num)) else: print("Number %i is not prime"%(num))
cb524e860f5d65308747b348ef1ce6d33a1f62df
cs50/cscip14315
/2021-06-29/guess2.py
369
3.921875
4
# Demonstrates validation of a command-line argument import random import sys if len(sys.argv) != 2: sys.exit("Missing command-line argument") maximum = int(sys.argv[1]) number = random.randint(1, maximum) guess = int(input(f"I'm thinking of a number between 1 and {maximum}: ")) if number == guess: print("Y...
4ff4b3e3f6b5dbc0625dd127aa76841d4765f2fa
cs50/cscip14315
/2021-07-01/bricks.py
144
3.8125
4
import sys try: height = int(input("Height: ")) except ValueError: sys.exit("Invalid height!") for _ in range(height): print("#")
cd3daa16687b750d62f37723ecfb62dab48036e0
cs50/cscip14315
/2021-06-29/printing_walls_0.py
177
4.15625
4
#Question and failsafe while True: n = int(input("What's the size? ")) if n > 0: break #Loops for _ in range (n): for _ in range (n): print("#", end="") print()
c69595fbda97bd350d84c7b3300dd2f5cc8062c3
cs50/cscip14315
/2021-06-28/loop1.py
96
3.859375
4
# Demonstrates a while loop, counting down i = 3 while i != 0: print("meow") i = i - 1
e7e93b6eb6eafc552e43ca6c415117f1c3ba6550
fwparkercode/ProgrammingPygame
/Problem Sets/ps_03.py
3,059
4.75
5
''' Chapter 3 Problem Set (16pts) Instructions: For each of the following, enter your answer below the numbered problem. For questions asking you to fix code, just change the code to make it work as intended. Make sure your file executes before you submit it! If a single problem is not working properly, please c...
275a084ead097adb5ea027810c33094d47a4f793
renzydwis/Renzy-Garry
/angkapositif2.py
179
3.8125
4
print("Masukkan nilai N:", end=" ") N = int(input()) if (N>=0): if(N>0): print("Bilangan positif") else: print("Nol") else: print("Bilangan negatif")
3ca7aa13d8faae32df65f5414c66ee9135af1b02
qwertyNodes/python-project-lvl1
/brain_games/games/even.py
285
3.640625
4
import random description = 'Answer "yes" if number even otherwise answer "no".' def generate_question_answer_pair(): rand_num = random.randint(1, 150) question = str(rand_num) correct_answer = 'yes' if rand_num % 2 == 0 else 'no' return question, correct_answer
cdc799d571916b09c95f3629f426aca726954a37
qwertyNodes/python-project-lvl1
/brain_games/games/progression.py
739
3.546875
4
import random description = 'What number is missing in the progression?' def gen_progression(quantity=10): rand_pass = random.randint(1, quantity) rand_start = random.randint(1, quantity * 10) progress_list = list() progress_list.append(str(rand_start)) for _ in range(quantity): rand_s...
8948b6ac45eda46b568dc64a5474368aa8c80f42
closer-1122/closer
/字典.py
1,303
3.734375
4
""" 字典的特点: 1、字典中的值没有顺序 2、字典的结构必须是键值对 key:value """ a={"name":"张三","表情":"哈哈","年龄":"22"} # 相当于把数组里的下标自定义了, 另外字符串在任何地方都要加引号 print(a) #取值 print(a["name"]) #新增 a["height"]="183cm" print(a) #修改 a["name"]="closer" print(a) # get方法 b=a.get("name") print(b) print("-------------------------------------") # updata pr...
e7deccf61153140830ffed5b40a4ca617fa3c724
closer-1122/closer
/循环/practice2.py
1,067
4.15625
4
# 练习2: # 使用代码,实现一个注册功能。 # 用户输入账号和密码,要求账号长度是5-8位,密码6-12位,并且账号必须小写开头。(账号开头必须小写不会) # 储存到字典中,{username:passward} a={} username=input("请输入你的账号:") while len(username)<5 or len(username)>8: username=input("请输入长度是5-8位的账号:") passward=input("请输入密码:") while len(passward)<6 or len(passward)>12: passward=input("请输入长度是6-12位的...
eaa4500301b897dfb4b5fac13356b1791ea2a282
supersid/GettingToKnowPython
/Assignment 3-Functions/function7.py
596
4.03125
4
# Take as input a number. Assume that for a number of n digits, the value of each # digit is from 1 to n and is unique. E.g. 32145 is a valid input number. def UniqueNumberCheck(number): number = str(number) flag = False for i in range(len(number)-1): for j in range(i+1,len(number),1): i...
fef12376583a7c8a41aaecd6f577a1739c869ce6
supersid/GettingToKnowPython
/Assignment 3-Functions/NumberRotate.py
446
3.578125
4
def LNumberRotate(n,d): a=str(n) Lstart = a[0:d] Lend = a[d:] Lcomplete = Lend+Lstart return int(Lcomplete) def RNumberRotate(n, d): a = str(n) Rstart = a[0:len(a)-d] Rend = a[len(a)-d:] Rcomplete = Rend+Rstart return Rcomplete if __name__ == '__main__': n = int(input("Ente...
6cccc61c1482f95c410fca59060ffffbe7782a6a
supersid/GettingToKnowPython
/Assignment 4-Arrays/Array1.py
306
4.125
4
def MaxNum(n): list=[] for i in range(n): num = input("Enter number") list.append(num) max = list[0] for j in range(len(list)): if list[j]>max: max = list[j] print("Maximum Number is ",max) n = int(input("Enter Size of Array")) MaxNum(n)
a0d58f60e05c7752aa9097d297e8497b263778b2
imtiazpy/BigO
/problemSolving/compound_interest.py
508
3.984375
4
#principle, Rate, Time def compound_interest(p, r, t): interest = p * ((1 + r / 100) ** t) #formula of interest return interest principle = int(input("Money you borrowed: ")) interest_rate = float(input("Your interest rate: ")) time = float(input("overall duration: ")) total_due = compound_interest(principle...
08858ac40e07bf0f46d252c142dc5c92f2111035
imtiazpy/BigO
/problemSolving/grades.py
469
3.984375
4
print("Enter your marks: ") sub1 = int(input("First subject: ")) sub2 = int(input("Second subject: ")) sub3 = int(input("Third subject: ")) sub4 = int(input("Fourth subject: ")) sub5 = int(input("Fifth subject: ")) avg = (sub1+sub2+sub3+sub4+sub5)/5 if avg >= 80: print("Grade: A+") elif avg >= 70: print("Gr...
cfbc86239e3e8526c93c2f8a42ec451a2a596af7
yjioni/python_algorithm_ex
/week 1-13. sum_str.py
519
3.671875
4
# 문제 설명 # 자연수 N이 주어지면, N의 각 자릿수의 합을 구해서 return 하는 # solution 함수를 만들어 주세요. # # 예를들어 N = 123이면 1 + 2 + 3 = 6을 return 하면 됩니다. # 제한사항 # N의 범위 : 100,000,000 이하의 자연수 def solution(n): answer = 0 for i in list(str(n)): answer += int(i) # ==> sum return answer # test print(solution(987)) print() # an...
dba4d107851724755e99cf3bd5d2c265683e1dff
yjioni/python_algorithm_ex
/week 1-15. sqrt(n).py
935
3.515625
4
# 정수 제곱근 판별 # 문제 설명 # 임의의 양의 정수 n에 대해, n이 어떤 양의 정수 x의 # 제곱인지 아닌지 판단하려 합니다. # x는 모름 # n이 양의 정수 x의 제곱이라면 x+1의 제곱을 리턴하고, # x는 n의 제곱근 ... sqrt(n) # n이 양의 정수 x의 제곱이 아니라면 -1을 리턴하는 함수를 # else: # return -1 # 완성하세요. # 제한 사항 # n은 1이상, 50000000000000 이하인 양의 정수입니다. import math def solution(n): x = math.sqrt(n) ...
6aa40f792da9615edf3bd83aa1c702b60bb33a8f
yjioni/python_algorithm_ex
/week 2-03. sorted([], reverse=True).py
778
3.6875
4
# 문제 설명 # 자연수 n을 뒤집어 각 자리 숫자를 원소로 가지는 배열 형태로 리턴해주세요. # 예를들어 n이 12345이면 [5,4,3,2,1]을 리턴합니다. # 제한 조건 # n은 10,000,000,000이하인 자연수입니다. print('----문제오인-----') print('숫자열 정렬') def solution(n): n = map(int, sorted(str(n), reverse=True)) answer = list(n) return answer print('-'*50) n = 12346 answer=[] def so...
b8471dd9fd39fea63400f14a2b99d2a73e7b009c
yjioni/python_algorithm_ex
/week 1-14. gcd(a, b) = gcd(b, r).py
626
3.546875
4
# 문제 설명 # 두 수를 입력받아 두 수의 최대공약수와 최소공배수를 반환 # 하는 함수, solution을 완성해 보세요. # 배열의 맨 앞에 최대공약수, 그다음 최소공배수를 넣어 반환 # 하면 됩니다. # # 예를 들어 두 수 3, 12의 최대공약수는 3, # 최소공배수는 12이므로 solution(3, 12)는 # [3, 12]를 반환해야 합니다. def gcd(n, m): return m if n % m == 0 else gcd(m, n % m) def lcm(n, m): return int(n * m / gcd(n, m)) de...
59db027a8e802b5ee6639fb8fa75b86c44e5d351
mehediemon007/UriSolved_with_Python
/uri2748.py
404
3.9375
4
for i in range(39): print('-',end="") print("") for i in range(1,10,2): if i == 1: print("| Roberto |") elif i == 5: print("| 5786 |") elif i == 9: print("| UNIFEI |") else: print(...
3487679149d3edb045e9d6c35aea173145dd783f
mehediemon007/UriSolved_with_Python
/uri2344.py
200
3.796875
4
x = int(input()) if x == 0 : print("E") elif x>=1 and x <=35: print("D") elif x>=36 and x <=60: print("C") elif x>=61 and x <=85: print("B") elif x>=86 and x <=100: print("A")
e304153614dc47db2ded4a275eff501db254e89b
samruddhibenkar/LetsUpgrade-Python-Essentials
/All Assignments/Assignment 7.py
344
4.34375
4
#!/usr/bin/env python # coding: utf-8 # # Samruddhi Benkar - Assignment No 7 # ## Make a Lambda function for capitalizing the whole sentence passed using arguments and map all the sentences in the List, with the lambda functions. # In[1]: myList = ["hi, i am samruddhi benkar."] capital = map(lambda a: a.title(), ...
e0b2624636552a9a452e479a29c74621385781ef
ronitgav/python_projects
/decoding_vanity_fair.py
1,167
4.21875
4
# -*- coding: utf-8 -*- """ Using the requests and BeautifulSoup Python libraries, print to the screen the full text of the article on this website: http://www.vanityfair.com/society/2014/06/monica-lewinsky-humiliation-culture. The article is long, so it is split up between 4 pages. Your task is to print out the tex...
5d8794d825701fbded7247901de7d000ad40d5e2
ronitgav/python_projects
/user_guessing_game.py
1,596
4.4375
4
# -*- coding: utf-8 -*- """ In a previous exercise, we’ve written a program that “knows” a number and asks a user to guess it. This time, we’re going to do exactly the opposite. You, the user, will have in your head a number between 0 and 100. The program will guess a number, and you, the user, will say whether it is...
e87b4d54497cc433c3e695b6ba06cb63f954f8d7
hassan510-cmd/Full-Stack-Using-Python---ITI-Course
/#29 session PYTHON-OOP2 Fri Oct 8 03:31:44 PM EET 2021/pypsql.py
1,656
3.890625
4
class employee: all_emp=[] def __init__(self,fname,lname,age,department,salary): self.fname=fname self.lname=lname self.age=age self.department=department self.salary=salary self.all_emp.append(self) print("added to employees") @staticmethod def g...
cad6011ecf296d4d91f07b7b21d25b480bab1a1c
asunathanr/asu_bc
/moving_bot/Coordinate/coord.py
909
3.84375
4
""" File: coord.py Authors: Pedro Reyes, Kelsey Lewis, Ryan Pounders, Nathan Robertson Purpose: A class that represents a coordinate on a grid. Coordinates have an x and a y component which acts like an index for that coordinate. """ __all__ = ["Coord"] class Coord: __slots__ = ('x', 'y') def __init...
abe6571a9916de5c27b84d0370be22b715295292
matlegdal/PyScrabble
/jeton.py
2,347
3.90625
4
from exception import * class Jeton: """ Cette classe représente un jeton. Les attributs d'un jeton sont: - lettre: str, représentant la lettre écrite sur le jeton. Par convention toutes les lettres au scrabble sont en majuscules. Dans ce travail nous ne considérons pas les jetons jok...
57b64ffbaeacfb9fede575ba898f6571dac879a7
Christopher-DeLaTorre/calculator-1
/custom calc.py
361
4.25
4
num1 = int(input("input a number "))#input asked for first variable and converted to int num2 = int(input("input another number "))#^^ num3 = int(input("input one last number "))#^ result = num1 + num2 + num3 #simple calculation stored in new variable adds all together result = result / 3 #gets the average of the three...
0221fda7e77d9a866410f802460d8e5a3377431e
shivanichauhan18/Recursion-function
/sumOfList.py
160
3.609375
4
def sum_list(n): print n if len(n)==1: return n[0] else: count=sum_list(n[1:])+n[0] return count print sum_list([2,4,10,15])
6bf4c4e1f42762d28add1483307a16d40a9ccbd8
ck88373/LeetCode
/125. Valid Palindrome/125. Valid Palindrome.py
345
3.859375
4
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ new_s = "".join([i for i in s if i.isalnum() or i.isalpha()]).lower() return new_s == new_s[::-1] if __name__=="__main__": print(Solution().isPalindrome("A man, a pla...
0066ee50612c6e8941724e67525d253e3b4c4c0d
pvardanis/Deep-learning-with-neural-networks
/Codes/sentdex/RNN_examples/RNN.py
2,866
3.875
4
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.python.ops import rnn, rnn_cell mnist = input_data.read_data_sets("tmp/data", one_hot=True) n_classes = 10 no_of_epochs = 10 # feed data in form of batches batch_size = 128 chunk_size = 28 n_chunks = 28 rnn_size = 128 ...
3a98a6d76b247757e5a97f463bfa2bd546f144e4
zengchenchen/OJ-Practice
/160.Intersection of Two Linked Lists.py
632
3.625
4
class ListNote(object): def __init__(self, val): self.val = val self.next = None class Solution(object): def getIntersectionNode(self): headA = ListNote('a1') headA.next = ListNote('c1') headB = ListNote('B1') headB.next = ListNote('B2') headB.next.next ...
888f0f7ae79bbfc8a5cdd150e2b4e5d7811489b7
zengchenchen/OJ-Practice
/35.Search Insert Position.py
373
3.765625
4
class Solution(object): def searchInsert(self, nums, target): for i in range(0, len(nums) - 1): if nums[i] < target <= nums[i + 1]: return i + 1 elif target <= nums[i]: return i else: i = i + 1 return i + 1 temp = ...
d24848bcc6a759f6f1c9a53024e0fc5d29172b26
knikharg/Route-based-on-cost-function
/route.py
3,270
3.734375
4
#!/usr/local/bin/python3 # route.py : Road trip! # # Code by: Kasturi Nikharge #from math import radians, cos, sin, asin, sqrt import heapq import sys class Graph(object): def __init__(self,graph): if graph == None: graph = {} self.graph = graph ...
f320ac63494eb9e54dd45480003292ff174e6e1c
nadirizr/liquid-crystal-simulation
/potentials/sphere_nearest_neighbours.py
4,462
3.578125
4
from util import * from potential import Potential, TwoSpinPotential class SphereNearestNeighboursPotential(Potential): """ This is an implementation of the potential interface for nearest neighbours potentials which can be passed on in the constructor. Nearest neighbours are selected within a sphere o...
6b290037a9ddf2df16f8829285624033793e9178
tatevhakobyaan/acahomework
/homework4.py
2,273
3.625
4
#Index Sum n = int(input()) A = [] for _ in range(n): A.append(float(input())) m = int(input()) IND = [] for _ in range(m): IND.append(int(input())) def sum_a(A): suma = 0 for el in IND: suma += A[el] print(suma) sum_a(A) #The most divisor-rich number a = int(input()) b = int(input()) a <= b lst...
1fd87a33e9058f6ffb00b8d74df2616bd9144479
Tununung/JerryHW
/0326/source/calc.py
214
3.859375
4
def oper(a,b,c): if c == "+": return a+b elif c == "-": return a-b elif c == "*": return a*b elif c == "/": return a/b else: return"只能加減乘除喔"
64ee772241fd73b54c54e62eb9b42bbaa8d44319
Neo44763/Mimic
/mimic.py
512
3.578125
4
import random import sys def mimic(dic, words): r = random.randint(0, len(words)) print(words[r]), pivot = words[r] for i in range(0, 100): listOfWords = dic[pivot] x = random.randint(0, len(listOfWords) - 1) print listOfWords[x], pivot = listOfWords[x] dic = {} words...
ea067bd1bc58e7d93e87691164d4c0bd63b578c5
Jaehi/python_practice
/2차원_리스트_사용하기/two_dimensional_list_while_while.py
154
3.765625
4
a = [[1,2],[3,4],[5,6]] i = 0 while i < len(a): j = 0 while j < len(a[i]): print(a[i][j],end = " ") j += 1 print() i += 1
84b27c46b2dcb8af4d3d0609ccd589236d1a8289
Jaehi/python_practice
/모듈과_패키지_구하기/judge_import.py
68
3.5
4
from math import pi a = float(input()) b = a * a * math.pi print(b)
b02b9fc74be40c2707e1c4638926e17e158d9d05
Jaehi/python_practice
/예외_처리_사용하기/try_except_else_finally.py
250
3.5625
4
try: x = int(input('나눌 숫자를 입력하세요')) y = 10 / x except ZeroDivisionError as e: print(e) print('숫자를 0으로 나눌수 없습니다.') else: print(y) finally: print('코드 실행이 끝났습니다.')
70e318be9f2d0423a65030ad5c1e05f7bb5bd96a
Jaehi/python_practice
/중간시험/question5.py
744
3.625
4
def func_a(month, day): base_month = 1 base_day = 1 day = 0 for i in range(base_month,month+1): if base_month != i: if i in [1,3,5,7,8,10,12]: day += 31 elif i in [4,6,9,11]: day += 30 else: day += 28 ...
4e6dcc4c1a3345e01e12541234652daea08bd57f
Jaehi/python_practice
/터틀_그래픽스_사용하기.py
1,408
3.734375
4
import turtle as t >>> t.shape('turtle') >>> t.foward(100) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'turtle' has no attribute 'foward' >>> t.forward(100) >>> t.right(90) >>> t.forward(100) >>> t.left(9...
81527c4b94a82d8bed1b35e217fe8146aa04c23c
Jaehi/python_practice
/데코레이터_사용하기/decorator_class_parameter.py
487
3.734375
4
class IsMultiple: def __init__(self,x): self.x = x def __call__(self,func): def wrapper(a,b): r = func(a,b) if r % self.x == 0: print(f'{func.__name__}의 반환값은 {self.x}의 배수가 맞습니다') else: print(f'{func.__name__}의 반환값은 {self.x}의 배수가...
124ec641558ce9757506d61891415f817739706d
Jaehi/python_practice
/클래스_상속_사용하기/class_has_a.py
210
3.5625
4
class Person: def greeting(self): print('hi') class PersonList: def __init__(self): self.personlist = [] def append_person(self, person): self.personlist.append(person)
ae8b8cbebd074eb996e4774f4824b81b2d457fcd
Jaehi/python_practice
/제너레이터_사용하기/generator_yield_from_iterable.py
93
3.609375
4
def num_generator(): x = [1,2,3] yield from x for i in num_generator(): print(i)
99d904ef54908d9504d952d657d8af3455ed9808
Jaehi/python_practice
/클래스_속성과_정적_클래스_메소드_사용하기/class_class_method.py
243
3.5
4
class Person: count = 0 def __init__(self): Person.count += 1 @classmethod def print_count(cls): print('{}명이 생성되었습니다'.format(cls.count)) james = Person() maria = Person() Person.print_count()
5eff0486a61a67c324c7a3a1a7e2a3a1b1fae7ad
Jaehi/python_practice
/파일_사용하기/file_for_write_string.py
111
3.578125
4
with open('hello.txt','w') as file: for i in range(3): file.write('hehi {0}\n'.format(i))
dd239decb8460c871334cb4c949b18bf89ccdaf8
devbiel/python
/projetos-treino/Calculo_da_Hipotenusa.py
595
4.28125
4
#calculo da hipotenusa de um triângulo retângulo import math cateto_oposto = float(input('Digite o cateto oposto: ')) cateto_adjacente = float(input('Digite o cateto adjacente: ')) calculo = (cateto_oposto ** 2) + (cateto_adjacente ** 2) triangulo = math.sqrt(calculo) print('A hipotenusa do triângulo retângulo é: {:.2...
6eddba7777adc93aa77c04e23a12b6eb9786c2cb
Avi9921/mypython
/assistant.py
1,360
3.53125
4
import os import pyttsx3 pyttsx3.speak("Hello, What can I do for you") while True: command = input("What can I do for you: ") command = command.lower() if "run" in command or "open" in command or "play" in command or "execute" in command: if "chrome" in command or "browser" in command: ...
fcfa2125dee18ff5ab3996b95238bd6e3c384572
guidumasperes/testing-fundamentals
/selenium/selenium_other_form.py
936
3.609375
4
from selenium import webdriver import random #Get our browser driver = webdriver.Firefox() driver.get('https://www.seleniumeasy.com/test/basic-first-form-demo.html') #Get our elements input_a = driver.find_element_by_xpath('//*[@id="sum1"]') input_b = driver.find_element_by_xpath('//*[@id="sum2"]') #Generate random ...
b3233052e7fb2c7795c3ff9dbbf84cd503c7de47
prashast-systango/Python
/Iterator-Generator.py
500
4.375
4
# Iterator # # Syntax : next(iterator[, default]) # (next()) function is used to fetch next item from the collection # Generator def mygenerator(n): for i in range(n): yield i #n = int(input("Enter number :")) n = 1000 obj1 = mygenerator(n) print(next(obj1)) print(next(obj1)) print() # Itetating in a s...
7cedba2f408d1c481a694a4f9b538777d0fa078e
prashast-systango/Python
/lists-tuples.py
1,655
4.40625
4
# creating a list # List can store multiple datatypes together a= [99, "Prashast", True, "Potter", 1.55, "False"] print(a) for i in a: print(i) # editing the list a[0]= "Dash" a[1]= "Harry" # a[5]= "Bill" we cannot add elements like this (gives error: index out of range) print(a) # List Slicing print(a[0:]) print...
16dbdac12bc3a3675ff2d176905b462733d52d38
prashast-systango/Python
/Day_6_Task/abstract.py
662
4.25
4
from abc import ABC,abstractmethod class Calculator(ABC): @abstractmethod def calculate(self): pass class Multiply(Calculator): def calculate(self,num1,num2): print("Result :",num1*num2) class Add(Calculator): def calculate(self,num1,num2): print("Result :",num1+num2) class Subs...
7d1157cccffa2f85a8ab983951abc3be25d786a4
prashast-systango/Python
/Sales_Tax_Task1/Task1.py
1,013
3.59375
4
# import csv file_input = open('Input1.csv',mode='r') input_data = file_input.read() # print(input_data) content_list = input_data.split("\n") # print(content_list) output_list = ['Product-Name,Product-CostPrice,Product-SalesTax,Product-SalesTaxAmount,Product-FinalPrice,Country'] # Dictionary includes (country : sales...
957e8b0d28ab5c49bd6131196f3f0603e8eab17a
prashast-systango/Python
/class.py
1,036
4
4
class New1(object): # constructor :will be called at the time of object creation def __init__(self): print("hello from __init__") # instance method def newMeth(self): print("hello from instance method") @classmethod def classMethod(cls): print("hello from class method")...
02608865eee69ff759bab79294613087beea76f0
prashast-systango/Python
/Enumerator.py
461
4.5625
5
# enumerate function fruits = ["banana","apple","mango","kiwi"] # using normal For loop for items in fruits: print(items) print() # here 'items' stores indexes and elements in the list for items in enumerate(fruits): print(items) print() # for index,items in enumerate(fruits): print(index) print(i...
02064fbde0df92367d11ee266b416e130e013413
prashast-systango/Python
/Sets.py
982
4.34375
4
# Set is a collection of non-repetitive elements # a = {1,2,3,1,1,1,1} # print(a) >>> {1,2,3} # Syntax # a = {} this is not an empty set(this is an empty dictionary) # a = set() this is an empty set a = {1,2,3,4,5} a1 = set() a2 = set() # (set.add()) # Syntax : set.add(element) a2.add(9) a2.add(21) a2.add(30) a2.ad...
ca0c9b2353680c2f683031d3ebe866b3773b6371
TheIrresistible/Python_Advanced_ITEA
/4/1.py
4,047
4.28125
4
from datetime import date from abc import ABC, abstractmethod class Person(ABC): def __init__(self, surname, year, month, day, faculty): self.surname = surname self.year = year self.month = month self.day = day self.faculty = faculty @abstractmethod def print_info...
de0cf420f829793dbdcb59999db95b3f24843718
JohnnyHsieh1020/Algorithms_Practice
/Longest_Common_Subsequence.py
844
3.65625
4
def lcs(word_a, word_b): rows, cols = len(word_a), len(word_b) table = [[0]*(cols+1) for z in range(rows+1)] sub_sequence = [] sub_sequence_size = 0 for i in range(rows): for j in range(cols): if word_a[i] == word_b[j]: table[i+1][j+1] = table[i]...
44e1e47b7ef3e73b4b309d545f2d21b3c1d079b4
JohnnyHsieh1020/Algorithms_Practice
/Factorial.py
308
3.875
4
def factorial(x): if x == 1: return 1 else: return x * factorial(x - 1) data = [1, 3, 6, 9] for i in range(len(data)): print('================================') print('Test ', i + 1) print('================================') print(data[i], '!=', factorial(data[i]))
8fdb14841cceb24a55a966927ffce70cb7f7c784
ekaksher/MachineLearningExercises
/Regression/Random Forest Regression/Random__Forest_Regression.py
765
3.546875
4
import numpy as np import matplotlib.pyplot as plt import pandas as pd #importing the dataset dataset = pd.read_csv("Position_Salaries.csv") X = dataset.iloc[:,1:2].values Y = dataset.iloc[:,2:].values #Predicting a new Result from sklearn.ensemble import RandomForestRegressor regressor = RandomForestRegressor(n_esti...
0c61f147ca6f8895a2cb922cd3532a360e34cdfa
linuxguin17/g-
/patientfile.py
646
3.71875
4
class patients: patientlist =[] patientnumber = 1001 patientroster=[] patientsymptoms =[] patientbed = 100 patientmedical = "icd-10" def makenewpatient(patients): print('A for Patient Roster') print('B for Patient Symptoms') print('C for Patient Bed') print('D for Patient Medical') s = input('Enter T...
a6c9298f32ff68c65eaec689c6c41bd9c642496a
yoy52012/python-practice
/check_files.py
1,175
4.03125
4
# -*- coding: utf-8 -*- # Script Name : check_files.py # Author : chao yuan # Created : 11th January 2017 # Last Modified : 13th January 2017 # Description : check the given file exists and whether we can read or not (检查所给文件是否存在且是否可以打开并读取) import os import sys def usage(): ''' ...
86cf99acd79f7ff0f0307296638fa3b0fd9a031c
SashaKor/mks66-line
/draw.py
1,791
3.890625
4
from display import * def draw_line( x0, y0, x1, y1, screen, color ): #setting origin pt, want second set of coors to be bigger than first #swap procedure if (x0 > x1): originX= x0 originY= y0 x0= x1 y0= y1 x1= originX y1= originY x = x0 y = y0 ...
17eb203db69861b378cc9eb31829d23055be6ea4
benri/UC-Davis-Algorithms
/fractional_knapsack.py
1,120
3.75
4
from random import randint from collections import namedtuple #for quick structs # define the struct structure Good = namedtuple("Good", "v w") # struct usage: # g = Good(3, 4) # print g def init_input(n=5): pre_g = [] for j in xrange(n): v = randint(1, 9) w = randint(1, 9) this_good...
906f39174b75960046c6ccf41cfdb9aaae6e4d79
Dudusa/Python_Study
/1.py
2,982
4.09375
4
#encoding = utf-8 #python3 6种标准数据类型 #数值 ''' a,b =123, 567 print(a*b) print(a+b) ''' #字符串 ''' c = 'hello world' print(c) #截取字符串,关系是大于等于,小于 print(c[:3]) #输出是hel print(c[1:3]) #输出是el print(c[3:-1]) #输出是lo worl print(c*3) #输出3遍c print(c+"Dusa") #字符串后面加上“Duda” d = c.split(" ") #用空格切割字符串,产生的是字符数组 print(d)...
8e98e7da8e57d3951307f320b3fe15046af3340b
kulbshar/Hello-World
/Python_Any_Or.py
2,312
3.828125
4
def schedule_interview(applicant): print(f"Scheduled interview with {applicant['name']}") applicants = [ { "name": "Devon Smith", "programming_languages": ["c++", "ada"], "years_of_experience": 1, "has_degree": False, "email_address": "devon@email.com", }...
85c6c10d8fc67cd53c81333a75ebf73cd626e329
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/AE105.py
767
3.765625
4
# Interweaving Strings # O(n*m) # n = len(one) | m = len(two) def interweavingStrings(one, two, three): if len(three) != len(one) + len(two): return False return explore(one, two, three, 0, 0, {}) def explore(one, two, three, p1, p2, cache): p3 = p1 + p2 if p3 >= len(three): return True if (p1, p2)...
a3741ee59d3768cb38472f17572dcf82bfdff213
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/AE147.py
820
4
4
# Merge Sort # O(n*log(n)) # n = len(array) def mergeSort(array): return aux(array, 0, len(array) - 1) def aux(array, start, end): if start == end: return [array[start]] midpoint = start + ((end - start) // 2) left = aux(array, start, midpoint) right = aux(array, midpoint + 1, end) ...
fa58694d60e5b8dd6f7db63b95dd2c6ecf999f1a
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC92.py
780
3.796875
4
# O(n) # n = len(head) # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode: preHead = ListNode(None, head) n...
97aeafb0c1071b26350bd8a31a22b5325edbc6ce
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/PRAMP11.py
1,048
3.75
4
# Array of Array Products # Given an array of integers arr, you’re asked to calculate for each index i the product of all integers # except the integer at that index (i.e. except arr[i]). # Implement a function arrayOfArrayProducts that takes an array of integers and returns an array of the products. # Solve without u...
0fe33cef5b2db7578af775695e1896f21a3a5855
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC105.py
1,318
3.703125
4
# O(n) # n = len(preorder) # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode: ...
1b0853a1bfdc92eacc24bdfa7710fdd27121705b
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/AE40.py
595
3.640625
4
# Find Successor # O(n) worst case, when tree is completely unbalanced # n = numberOfNodes(tree) # This is an input class. Do not edit. class BinaryTree: def __init__(self, value, left=None, right=None, parent=None): self.value = value self.left = left self.right = right self.paren...
4498c929d849608305e1b2055db93371e4df89ae
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/PRAMP9.py
1,183
4.15625
4
# Sentence Reverse # You are given an array of characters arr that consists of sequences of characters separated by space characters. # Each space-delimited sequence of characters defines a word. # Implement a function reverseWords that reverses the order of the words in the array in the most efficient manner. # Expl...
c11b57858c08efd5da3f5b782713be1907c946c8
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/AE103.py
691
3.90625
4
# Merge Linked Lists # O(n+m) # n = len(linkedList1) | m = len(linkedList2) # This is an input class. Do not edit. class LinkedList: def __init__(self, value): self.value = value self.next = None def mergeLinkedLists(headOne, headTwo): resHead = LinkedList(None) cur = resHead while headOne...
75d6a039f357eb219e8cf3cea309d613ba644a89
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC56.py
541
3.515625
4
# O(n * log(n)) # n = len(intervals) from typing import List class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: intervals.sort(key = lambda interval: (interval[0], interval[1])) res = [intervals[0]] for i in range(1, len(intervals)): current = res[-...
190da3ccd77acf363b9e6b2aab58968d1fca2175
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/AE49.py
575
3.75
4
# Breadth-first Search # O(n) # n = numberOfNodesBelow(self) # Do not edit the class below except # for the breadthFirstSearch method. # Feel free to add new properties # and methods to the class. class Node: def __init__(self, name): self.children = [] self.name = name def addChild(self, nam...
cd9bdfacf57b35bf5d5e3788fbeb4767f9cfaf92
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC572.py
1,017
3.8125
4
# O(n*m) # n = numberOfNodes(root) | m = numberOfNodes(subRoot) # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSubtree(self, root: TreeNode, subRoot...
d91b7a16060aaf6c2e94b367c13149279e265e51
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC222.py
1,574
3.890625
4
# O(log(n)²) # n = numberOfNodes(root) # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def countNodes(self, root: TreeNode) -> int: height = self.c...
1b31aaa5c52a5a76374c178a642c804ec09d27c1
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC1457.py
926
3.765625
4
# O(n) # n = numberOfNodes(root) # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def pseudoPalindromicPaths(self, root: TreeNode) -> int: return self.explo...
9b85bdcece3461b4a476b76ae8bdee0495f56d5e
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC662.py
1,035
3.578125
4
# O(n) # n = numberOfNodes(root) # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: levels = {} ...
8cc468f724520de11032a13b3fd35c8974b0989d
vCra/pipeline
/pipeline/utils/queue.py
1,021
4.125
4
from queue import PriorityQueue class UniquePriorityQueue(PriorityQueue): """ Constructor for a UniquePriorityQueue, similar to the built-in PriorityQueue, but also stores elements within a Set, in order to easily facilitate efficiently checking for duplicates within the queue. If a duplicate object is ad...
db4c9a2cd668f9fe30845cec4fa3fc34f185487d
BetaLixT/CsvToJson
/main.py
1,174
3.515625
4
import argparse import csv import configparser import json parser = argparse.ArgumentParser(description='Convert from CSV to json') parser.add_argument('--input', dest='inputFile', default="sample.csv", help='csv input file') parser.add_argument('--output', dest='outputFile', default="sample.json", help='json output f...
84ede0b37d4b433b32f766910686b57aa9c9a82a
mpwellen/NumericalMethods
/Numerical_FinalProject.py
1,766
3.59375
4
# -*- coding: utf-8 -*- """ Created on Thu May 16 12:51:43 2019 @author: Michael """ from math import exp from math import sin from math import pow def f(x,y): z=0.000 z = exp(sin(50.0*x)) + sin(60.0*exp(y)) + sin(80.0*sin(x)) + sin(sin(70.0*y)) - sin(10.0*(x+y)) + (x*x+y*y)/4.0 return z ...
62f54f3f45842285bf956ef3c963aabf0f7eb2da
stekkelpak/stekkelpak
/rpc.py
3,369
4.3125
4
#!/usr/bin/env python3 import random """This program plays a game of Rock, Paper, Scissors between two Players, and reports both Player's scores each round.""" moves = ['rock', 'paper', 'scissors'] """The Player class is the parent class for all of the Players in this game""" def beats(one, two): # The beats ...