blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
4a3991f14b8d9997b2247be05a859bd698d936f8
kimdohui/Python_Study
/unit 1~10/unit7/값 여러 개 출력하기.py
300
3.65625
4
print(1,2,3) print('Hello','world') # print에 변수나 값을 콤마로 구분해 넣으면 각 값이 공백으로 띄워져서 한 줄로 출력 print(' ') print(1,3,5, sep=', ') print('hi','fi',sep='') # sep을 활용하면 출력할 때 값 사이에 다른 문자들을 넣을 수 있음
0173898f8cf5566101d97dba0793766e9ac6d567
sarahdrake/DojoAssingments
/Python/python_fun/coin_toss.py
611
3.921875
4
import random def coin_toss(): head_count = 0 tail_count = 0 for i in range(5001): toss = random.randint(1,3) if toss == 1: head_count += 1 print "Attempt #" + str(i) + ": Throwing a coin... It's a head! ... Got " + str(head_count) + " head(s) so far and" + str(tail_...
e75b3b471f5dc6babb58d8eee7ec0c5f05a9df71
MohammedAiyub/Python1
/Arithmetics/4)Arithmetic.py
472
3.71875
4
# 4)Arithmetic import math a,b = float(input("Enter the first number:")),float(input("Enter the second number:")) print("\nSum of %.2f and %.2f is %.2f" %(a,b,a+b)) print("Difference of %.2f and %.2f is %.2f" %(a,b,a-b)) print("Production of %.2f and %.2f is %.2f" %(a,b,a*b)) print("Quotient when divide %.2f by %...
5e5b89fb2ab62daddb87cf78ee8b6edd3077e421
kr-ann/search_engine
/tests/tests_for_Iterator.py
2,184
3.890625
4
""" Tests for the 'abstract_iterator'. """ import abstract_iterator as it import unittest class TheTests(unittest.TestCase): def test_1(self): first = [1,2,3,4] second = [5,6,7] third = [8,9,10,11,12] ideal = [1,2,3,4,5,6,7,8,9,10,11,12] result_1 = list(it....
a74d438b642cc7df3fbdb0acc5617ebda2b2d63e
aeyc/8PuzzleSolver
/hw2.py
3,960
3.71875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 21 16:54:25 2020 @author: Ayca """ import numpy as np import copy ######################################### # # # GENERATION # # # ###############...
74c07de140a924fe33d9c909690640116bec9c56
Faranaz08/python_assignment
/avgtest.py
333
4.09375
4
a=int(input("test1=")) b=int(input("test2=")) c=int(input("test3=")) avg=(a+b+c)/2 print("the avg of tests is="+str(avg)) #to take avg of best 2 out of 3 big1 =a if a>b else b print(str(big1)) big2= b if a>c else c print(str(big2)) AVG=(big1+big2)/2 print("Average of best of 2 out of 3 is :"+str(AVG)) ...
b20686e76325a4f6c4ced98b93eb87824e2e6bfb
SnShine/Project-Euler
/12.py
528
3.5625
4
import math def trianglenumber(n): #sigma function return (n*(n+1))/2 def divisors(n): ans= 0 i= 1 while i<= math.sqrt(n): if n%i== 0: if i!= int(n/i): ans+= 2 if i== int(n/i): ans+= 1 i+= 1 return ans for k in range(12...
c047e44ab661e1fbd579c5af71e1556be1ab33d5
acarreiragonzalez/AcademiaCelia-exposisao
/lib/build/scripts-2.7/BaseDatos.py
2,106
3.625
4
# -*- coding: utf-8 -*- import sqlite3 class BaseDatos: #Establecemos conexion e engadimos un cursor que percorrerá os valores def __init__(self): self.conec = sqlite3.connect("BASEALUMNOs") self.c = self.conec.cursor() def borrarTablaAlumnos(self): #En caso de necesitar borrar la tabla. ...
66ac9c4b31b343d5db15d2de531c1fe119bb9802
dbrandt2/DanPortfolio
/GridPathFinding/GDD3400-GridPathFinding/Edge.py
292
3.59375
4
class Edge(object): """Generic Edge to be used with the generic Graph""" # Initialize the edge with its nodes and weight def __init__(self, n1, n2, weight): self.n1 = n1 self.n2 = n2 self.weight = weight return # Get the weight of the edge def getWeight(self): return weight
73f722212d212aaf1c99159978a8b644d961fa31
Aasthaengg/IBMdataset
/Python_codes/p03477/s528083943.py
151
3.859375
4
A = input().split(" ") L = int(A[0])+int(A[1]) R = int(A[2])+int(A[3]) if L>R: print("Left") elif L == R: print("Balanced") else : print("Right")
863ec678a02e4da3a68c986c6228c817363e8a0f
melpomene/GeneticPixels
/notgenetic.py
860
3.515625
4
""" This is the result that we want the genetic algorithm to do. """ from PIL import Image from random import randint, random def find_color_square(img): colors = img.getcolors(img.size[0]*img.size[1]) r=0 g=0 b=0 for c in colors: r += c[0] * c[1][0] g += c[0] * c[1][1] b +...
08fe7e1105a20139b795f77c6d4f2e512e9cea72
nunrib/Curso-em-video-Python-3
/MUNDO 2/ex055.py
339
3.859375
4
maior = 0 menor = 0 for c in range(0, 5): a = float(input('Digite o seu peso: ')) if c == 0: maior = a menor = a else: if a > maior: maior = a if a < menor: menor = a print(f'\nO maior dos pesos lidos foi {maior}Kg e o menor dos pesos lidos...
f30c5365489ce30049a8ba5af501d072d9d0d7a1
Mohdwajtech/Calculator
/.ipynb_checkpoints/calculator-checkpoint.py
1,321
4.3125
4
import operations import scientific def display(): choice=int(input("1.Add two numbers\n2.Subtract two numbers\n3. Multiplication of two numbers\n\n4. Log of a number\n")) return choice def operate(choice): if choice==1: number_1=input("\nEnter first number") number_2=input("\nEnter second...
9858af2fa4a7dbd4a8fe5b2f8267f51a8821574d
akaKAIN/SQL-basic
/123.py
641
4.09375
4
revenue = int(input('Введите выручку фирмы: ')) costs = int(input('Введите издержки фирмы: ')) if revenue > costs: profit = revenue - costs print(f'Фирма получает прибыль в размере: {profit}') rent = profit / revenue print(f'Рентабельность выручки: {rent}') elif revenue < costs: print('Фирма несёт у...
3673951dfb092af08712623f2549cc2999f167ce
TimeFur/MachineLearning
/Agent/regression.py
1,063
3.953125
4
import numpy as np import matplotlib.pyplot as plt from sympy import * #residual = (y - (ax + b))^2 def linear_regression(x, y): a, b = symbols('a b') residual = 0 num = len(x) for i in range(num): residual += (y[i] - (a * x[i] + b)) ** 2 #print expand(residual) #differential to ...
423113d14663372faf85a62e153ab07279ee599c
ajayrot/Python7to8am
/Datatypes/Demo15.py
340
3.609375
4
s1 = {} print(s1) # {} print(type(s1)) # <class 'dict'> print("============================") s1 = {10,20,30,40,50,40,50} print(s1) # {10,20,30,40,50} print(type(s1)) # <class 'set'> print("============================") s1 = {10,20,30,40,50,40,50} print(s1) # {10,20,30,40,50} emp = {"Ravi",23,9876543210,125000....
54082ca9cbff017790aefc3cb156e728a04b1189
RossMcKay1975/intro_to_python
/named_tuples.py
435
3.609375
4
from collections import namedtuple import datetime # Person = namedtuple("Person", "name age job_title") # # john = Person("John", 37, "instructor") # jane = Person("Jane", 27, "instructor") # print(john.name) # print(john.age) # print(john.job_title) Employee = namedtuple("Employee", "name ni_number dob") ross = Em...
ecdb496386017678c5c4ef77a7c999da6195fad9
garigari-kun/til
/src/basic/basic/default_dict.py
483
3.84375
4
from collections import defaultdict def default_dict_example(): pairs = {('a', 1), ('b', 2), ('c', 3)} normal_dict = {} for key, value in pairs: if key not in normal_dict: normal_dict[key] = [] normal_dict[key].append(value) print(normal_dict) default_dict = defaul...
ba1cddd26debba2f925ec0511f358bc53b972af7
vrnsky/python-crash-course
/chapter9/ice_cream_stand.py
1,183
3.9375
4
class Restaurant: def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type self.number_served = 0 def describe_restaurant(self): print("There is", self.restaurant_name, " and its cuisine type is", self.cuisine_ty...
565e5f0858149a7bfa33095adda89221a62ea15f
himanshu9xm/Random-Projects
/Clock Hand.py
552
3.59375
4
import time startTime = time.time() timePeriod = eval(input()) longitude = eval(input()) atLongitude = (24 / 360) * longitude atLongitude = (round(atLongitude, 2)) # print(atLongitude) atLongitude *= 100 hour = int(atLongitude / 100) minute = int(atLongitude % 100) minute *= 0.6 # print("hour", hour) angleHour = 0.5 * ...
3edf0f5015f0d9fc50ee996233e9b127fd246219
jethropalanca/Quantnet_Python
/Level1/Section1_2/Exercise9.py
722
3.84375
4
''' List Comprehension that results in a list of numbers 0 through 10,000,000. ''' import time def main(): lst = [i for i in range(10000001)] start = time.time() lst2 = [] for value in lst: if value % 10 == 0: lst2.append(value) end = time.time() print('Time in seconds for ...
9467bdbbf60416e29d2092cc1a9d591f38a541eb
dervit1/Aulas-Praticas-2021-2
/PPSI(420-01) SEG Manha/2021-09-20/programa39.py
590
4.09375
4
# exercício 17 do estudo dirigido (Estrutura de Seleção If-Else) n1 = float(input("Digite a nota de 1ª avaliação: ")) n2 = float(input("Digite a nota de 2ª avaliação: ")) media = (n1 + n2)/2 print("A média é", round(media, 2)) if media >= 7: print("Aluno Aprovado") else: n3 = float(input("Digite a...
8a4a7bc45e378d1ea890b6d6eb6ae96130df3a85
Himanshu-Mishr/projecteuler
/problemAPages.py
840
3.640625
4
""" Purpose : A. page problem """ def main(): # input b = input().split(' ') n,p,k = int(b[0]), int(b[1]), int(b[2]) x = left(n, p, k) y = middle(p) z = right(n, p, k) print(x+y+z) # left string def left(n, p, k): counter = p-1 astring = "" while counter > 0 and k > 0: ...
e2b38407827f71e012bb5ddcbd03e2af602401b8
mhaig/adventofcode
/2017/day16/day16.py
2,168
3.640625
4
from __future__ import print_function import sys from collections import Counter def get_input(): """Get input from stdin and return as a string.""" # TODO move into something common so I can pull this out of all these # scripts. data = '' for line in sys.stdin: data += line data = dat...
020cbec04fe8f884014ce06c989ee39eefdbda8f
w326004741/python-fundamentals-problems
/09-Newtons-method-for-square-roots.py
773
4.09375
4
# Implement the square root function using Newton's method. In this case, Newton's method is to approximate sqrt(x) by picking a starting point z and then repeating: # z_next = z - ((z*z - x) / (2 * z)). # by Weichen Wang def f(x): # define is used to declare the f(x) function and return any eqution just you like....
5c7e6b5e1f9e7ce6d671fb543d7c94054d4a7bce
gh-Devin/python_study_group
/simple_project/SchoolMember.py
849
4.0625
4
#-*- coding:utf-8 -*- class SchoolMember: '''学校成员父类''' def __init__(self, name, age): self.name = name self.age = age def tell(self): print("Name:'{}' Age:'{}'".format(self.name, self.age)) class Teacher(SchoolMember): '''老师子类''' def __init__(self, name, age, salary): ...
0ee2e9247af0f6477dbf325fd2157ac04edc7521
DaryaIvasyuk253/python_7_10
/hw_17_20.py
2,256
3.6875
4
import math import random #task_17 #--------------------------------------- def solve_quadratic_equation(a, b, c): find_discriminant = b**2 - (4 * a * c) if a == 0: return None, None elif find_discriminant > 0: root1 = (- b + math.sqrt(find_discriminant)) / (2 * a) root2 = (- b - math...
dbb1da44ea282f9dc829732d5e8307bc4ffcca5c
Jimbiscus/Python_Dump
/Garlic bread/tempCodeRunnerFile.py
789
3.734375
4
: list_of_fwords.append(word) print(f"Il y a {count_words} mots qui finissent par e .") for word in list_of_words: print(f" - {word}") print(f"il y a {count_fwords} mots qui commencent par f") for fword in list_of_fwords: print(f" - {fword}") words_count = {} longestF = [] for fword in list_of_fw...
79e804bdf3a141b48654cbcbaa19f68b8c142d3b
anhaidgroup/py_stringsimjoin
/py_stringsimjoin/filter/filter_utils.py
4,101
3.859375
4
from math import ceil from math import floor from math import sqrt from sys import maxsize def get_size_lower_bound(num_tokens, sim_measure_type, threshold): """Computes lower bound for size filter. Specifically, computes lower bound on the number of tokens a string must have in order to obtain a simila...
324047c2caf7ac25368184a118620d596d796c15
zenodallavalle/leetcode
/longest-common-prefix/longest-common-prefix.py
687
3.53125
4
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: # strs = sorted(strs, key=len) substring = strs[0] def repeat(substring:str): while True: yield substring def hasPrefix(s:str, prefix:str)->bool: ...
4d04ad36e57449d3758fce22568db7f3bb313a30
CleitonSilvaT/URI_Python
/1-Iniciante/1150.py
510
3.859375
4
# -*- coding: utf-8 -* if __name__ == '__main__': # Entrada x = int(input()) z = int(input()) # Ler valores ate que z seja maior que x while (z <= x): z = int(input()) # Variaveis soma = 0 valores = 0 for i in range(x, z): # Condicao de parada if(soma > z)...
d2ca56ea0d2c3098fc1d1f6ee6bda98c12100bf0
misha-sauchuk/python130218-HW1
/HomeWork_08/ex08_3.py
1,188
3.90625
4
"""Реализовать программу с базой учащихся группы (данные хранятся в файле). Записи по учащемуся: имя, фамилия, пол, возраст. Программа должна предусматривать поиск по одному или нескольким полям базы. Результат выводить в удобочитаемом виде с порядковым номером записи.""" # import function to find students in list fro...
9b2c933b2bd275071281c9202c1394c41f2570ea
TheManOfTeel/zipReader
/zipReader.py
1,970
4
4
while True: # So the program doesn't exit after every execution from zipfile import ZipFile # to manage the zip file import datetime # for date modified import sys # to read output import os # to view the file def zipRead(file): # opening the zip file in read mod...
25dacf53541f8eb5dcaf9c3c43d0a4bfcc311f23
RT-Thread/IoT_Board
/examples/31_micropython/packages/micropython-v1.10.1/docs/code-completion/math.py
4,628
3.546875
4
""" math 模块提供了对 C 标准定义的数学函数的访问。 本模块需要带有硬件 FPU,精度是32位,这个模块需要浮点功能支持。 """ e = ... # type: int pi = ... # type: int def acos(x) -> None: """传入弧度值,计算cos(x)的反三角函数。""" ... def acosh(x) -> None: """返回 x 的逆双曲余弦。""" ... def asin(x) -> None: """传入弧度值,计算sin(x)的反三角函数。 示例: - x = math.asin(0.5) - pri...
84efddf676408573b411f9a4ed14ae5a158166f5
aseemchopra25/Integer-Sequences
/Prime Numbers/Prime_22Jul.py
446
4.0625
4
# This Algorithm prints all prime numbers based on user input. # Requesting user input for starting Number and ending Number start = int(input("Enter starting number: ")) end = int(input("Enter end number: ")) # For loop to loop through numbers from the inputted start and end numbers for i in range(start, end + 1): ...
f296d4de844050e3b727a135773e0005b14b1e4d
xiaoling000666/python
/leetcode/13.py
371
3.625
4
class Solution(object): def intToRoman(self, num): dic1=['M','CM','D','CD','C','XC','L','XL','X','IX','V','IV','I'] dic2=[1000,900,500,400,100,90,50,40,10,9,5,4,1] for i in range(len(dic1)): while num>=dic2[i]: num=num-dic2[i] p...
00591b65c6cfe66df01dc7db6b6f6047b45f5ede
yxrobert/yx_python
/web/test.py
2,199
3.796875
4
# _*_ coding: utf-8 _*_ from collections import OrderedDict # # Definition for a binary tree node. # # class TreeNode(object): # # def __init__(self, x): # # self.val = x # # self.left = None # # self.right = None # # class Solution(object): # def __init__(self): # self.m = {} ...
43fb0e3c7cc97da4f606ae9613dda0602973b1d0
shlokashah/Coding-Practice
/Trees/BST iterator.py
1,015
3.921875
4
# 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 BSTIterator: # l = [] def __init__(self, root: TreeNode): head = root self.l = [] self.l =...
a4c453f5d1c5338e0c67477e722cd91cbacc2913
Venktesh98/Stuff_CWPA
/AstroCrypt-master/AstroCryptV1.0.py
6,046
3.921875
4
#Does the encryption by using SHA256 and generates the key unique # AstroCrypt is an cryptographic encryption-decryption tool written in Python which uses AES-CBC encryption technique. # It uses the AES-256-CBC cipher and encodes the encrypted data with Base64. # In simple terms, user can use the tool to encrypt t...
62b285e9759dfa2f76bf3206b5dcbb9de2bbb7eb
P4Kubz/no_quiero_otro_repositorio_aaaaaaaaaa
/While/testwhile.py
2,064
3.796875
4
from random import randint VIDA_INICIAL_PIKACHU = 80 VIDA_INICIAL_SQUIRTLE = 95 SIZE_BARRA_DE_VIDA = 20 vida_pikachu = VIDA_INICIAL_PIKACHU vida_squirtle = VIDA_INICIAL_SQUIRTLE while vida_pikachu > 0 and vida_squirtle > 0: #Se desenvuelven los turnos de combate #Turno de Pikachu print("Turno de Pikachu"...
b5561fd4a9a90659389e6830eb5e3845b9f53b00
johan-mattias/google-code-jam-2017
/pancakeflipper/problem1.py
1,135
3.6875
4
import sys # raw_input() reads a string with a line of input, stripping the '\n' (newline) at the end. # This is all you need for most Google Code Jam problems. debug = 0 t = int(raw_input()) # read a line with a single integer for i in xrange(1, t + 1): n, k = raw_input().split(" ") # read a list of integers, 2...
96610a28f70f34884135ca7c03771e0b9a49b6fe
VikMaamaa/python-projects
/project 1/OhmsLawR.py
559
4.28125
4
#Group 1, 2/5/2020 print("\t\tCalculator for Resistance\n") print("This will determine the resistance given a current and voltage value") V = float(input("What is the Voltage in Volts? ")) I = float(input("What is the Current in amps? ")) R = V/I print("The resistance is {} ohms".format(R)) print("\n\t\t\t{}oh...
82b8e59a84b9624325762100f4c897f2b27d353c
TashanM/Programs
/C4 Exercise 9.py
219
3.765625
4
# Exercise 9 # Tashan Maniyalaghan # 693776 # ICS3U0-B # 3 October 2017 # Mr. Veera time = int(input('Enter the time in minutes:')) hours = time//60 minutes = time%60 print ('The time is: %i:%02d' %(hours, minutes))
b93472472dc9b1ad3c48f432007379a27706b809
red-swan/programming-problems
/interview-cake/28-matching-parens.py
564
3.609375
4
def get_closing_paren(string, opening_paren_index): count = 0 for idx in range(opening_paren_index,len(string)): char = string[idx] if char == '(': count += 1 elif char == ')': count -= 1 else: pass if count == 0: retu...
7e16ed29ba8a9312095feba303ae15065762f892
afettouhi/ThinkPython-py38
/Chapter 10/Exercise_10-5.py
208
3.8125
4
def is_sorted(l): if len(l) == 1: return True else: if l[0] > l[1]: return False return is_sorted(l[1:]) print(is_sorted([1, 2, 2])) print(is_sorted(['b', 'a']))
e8ebf06d1487d5ed805339d3ced9c303d6f0a55f
doitfool/leetcode
/Valid Parentheses.py
1,132
3.640625
4
""" @Project: leetcode @file: Valid Parentheses.py @author: AC @time: 16-5-12 @Description: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid b...
1fe02fe984d2006ff81359cf00aba3bcacf2dadd
nareshenoy/base
/src/script/project_euler/51.py
4,516
3.625
4
import math isprime_arr = [True] * 1000001 considered_sequences = [] def considered(n, s): digit_list = [] while n > 0: digit_list.append(n % 10) n = n / 10 for d in s: digit_list[d - 1] = -1 str_list = str(digit_list)[1:-1].replace(', ', '') if str_list in consi...
ce472a47bb3334daddde9f9dc3b1333610d2a7d7
AlexandraFil/Geekbrains_2.0
/Python_start/lesson_3/2.py
1,545
4.25
4
# 2. Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: # имя, фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы. # Реализовать вывод данных о пользователе одной строкой. def my_func(name = "ivan", surname = "smith...
1d7fcea3c5ee5a00fd4762e4c52d810d0ffd24cc
GabrielCirstea/AI-KR
/Tema1/main.py
16,571
3.515625
4
#!/usr/bin/python3 import copy import sys import time import os # informatii despre un nod din arborele de parcurgere (nu din graful initial) class NodParcurgere: def __init__(self, info, parinte, cost=0, h=0): self.info = info self.parinte = parinte # parintele din arborele de parcurgere ...
52130ea26f31a92c551e09e457dc563436ad0a95
VanJoyce/Algorithms-Data-Structures-and-Basic-Programs
/radix sort.py
7,095
3.90625
4
# Vanessa Joyce Tan, 30556864 # Assignment 1 Task 1 """ - create count-array that is length (base-1) e.g. base 10 should have count array of length 9 - number of count array should be equal to the number of digits - make sure to use a STABLE method because radix sort depends on stability (e.g. linked list...
458d441f7d29188632387d2defb35453920c4462
bathcat/pyOiler
/src/pyoiler/problems/euler034.py
950
3.953125
4
from typing import Iterable import itertools as it from ..shared.solver import Solver from ..shared.digits import digit_factorial_sum def is_curious(n:int)->bool: return n == digit_factorial_sum(n) def curious_numbers(up_to:int = None) -> Iterable[int]: for i in it.count(3): if is_curious(i): ...
5589b8222ad71c90b42bbb314bbe381163d1ace8
leejunejae/python
/2017308055이준재(6주차-2).py
561
3.71875
4
import threading class sum : sumName='' def __init__(self,name) : self.sumName=name def numsum(self,first,last) : result=0 for i in range(first,last+1) : result+=i print("1+2+3.....+ ",last," = ", result) sum1=sum('1000까지합') sum2=sum('100000까지합') ...
20f966ca792d8cd45efd9ae8dc506c96c4e1c97c
engineersamuel/algorithms-and-datastructures
/sort/selection/selection.py
1,035
4.125
4
def selection(arr): for i in range(0, len(arr)): # Min idx starts always at the ith element min_idx = i # Look for any local minima going forward for j in range(i+1, len(arr)): # If we find one, set the min_idx to what we find if arr[j] < arr[mi...
fdf968103f669fafa042851313d7483f72ebc713
thisisthefuture/advant-of-code-2019
/day01_02.py
1,105
4.03125
4
# ITERATIVELY # import math # def fuel_amount(mass): # return math.floor(int(mass)/3) - 2 # txt = open("day01_input") # total = 0 # for line in txt: # remaining_fuel = int(line) # each line is the mass of a module # fuel = 0 # setting the default fule requirement per module # while...
87f0e88995a55d0f4a8224193ab0abad6d4babcc
cristyferbrunoc/cursoemvideo
/Desafio004.py
548
3.890625
4
class Desafio004: def somarNumeros(self): numeroUm = int(input("Digite o primairo numero: ")) numeroDois = int(input("Digite o segundo numero: ")) somar = numeroUm + numeroDois print(f"A soma dos numeros {numeroUm} + {numeroDois} é = {somar}") def mostraInformacao(self): ...
d3d1f80c4a0de1e71d514fbc3525f1371c85e04a
Rchana/python-projects
/hangman.py
1,360
4.09375
4
#Hangman Game import random print("") print("~ WELCOME TO HANGMAN ~") print("") yes_no = "yes" while yes_no == "yes": word_list = ["school", "flowers", "Canada", "movies", "Food"] word = str(random.choice(word_list)).lower() length = len(word) lives = length + 3 correct_guesses = 0 list_of_le...
5096f4fb21aa81bc947c5a0499b7546bcef3cc2d
HiddevdBos/AIT
/hangman.py
3,001
4.03125
4
from player import * # start of the game, player chooses a word and def startGame(player_1, player_2): player_1.chooseWord(len(player_2.result())) # choose a random word player_2.getwordLength(player_1.giveAnswer()) # tell player_1 how many letters the word is player_2.wordLength() # process word length print(p...
43a90b2bfd47694023c42898bd09da21c7009e5e
NhanGiaHuy/Practicals
/prac_10/wiki.py
101
3.640625
4
import wikipedia book_title = str(input("insert book title")) print(wikipedia.search(book_title))
1e784289bb77d7b5f7285d3fa795ac5a38f4baf0
mplouque/Python-Projects
/euler3&4.py
2,679
3.921875
4
########################################################################################### # Name: Matthew Louque # Date: 2/4/2016 # Description: Solves Project euler problems 3&4 ########################################################################################### # it may help to make use of some math f...
9bb0a5b670c31201f039e3f7f822dbe20e437240
lazarchitect/ChainPass
/app.py
1,463
4.09375
4
print("What account?") print("(Type \"add\" to create a new account/password entry or \"delete\" to remove one.)") x = input(">> ") if x == "print": with open("pw.txt", "r") as reader: fil = reader.read() fil = eval(fil) for i in fil: print ("\t", i, ":", fil[i]) elif x == "delete": name = input("What acc...
06c883f6436a805b885340e1dadb057004ca20c6
MattAmponsah/Lab-1-fin
/main.py
428
4.1875
4
Temp1= float(input("Enter temperature: ")) unit = input(" Enter unit in F/f or C/c: ") tempc = float((Temp1-32.0)*5.0/9.0) tempf = float(Temp1*9.0/5.0+32.0) g = chr(176) if unit == 'F' or unit == 'f' : result = print(f"{Temp1} in Fahrenheit is equivalent to {tempc} Celsius.") elif unit == 'C' or unit == 'c' : ...
543d7f3b15cdb0dbb9c3021ef73d34e8662c83e6
MirroAi/python-100
/61-70/case70.py
456
3.796875
4
# -*- coding: utf-8 -*- # @Author: MirrorAi # @Date: 2020-01-10 21:26:14 # @Last Modified by: MirroAi # @Last Modified time: 2020-01-10 21:28:52 # 写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度 def get_length_of_string(s): return len(s) def main(): s = input("请输入字符串:") print("字符串长度为 %d" % get_length_of_strin...
b12fca115cf182aa293b62c3ca7b8a15fac215b7
alexajan/GTLKazakhstan
/madlibs_solution.py
2,308
3.890625
4
# Madlibs Game harry_potter = ["On his 11th birthday, young ", " Potter discovers the ", " he never knew he had, the ", " of a/an ", ". In his first ", " at Hogwarts School of Witchcraft and ", " he meets his two ", " friends Ron Weasley, an expert at Wizard ", ", and Hermione Granger, ...
5691deda010e58e9f5a1d80fab543156ee3e40e9
sixsam/mycode
/cal_5_6.py
842
3.9375
4
def calc(expr): exprl = expr.split(' ') try: exprl_0 = int(exprl[0]) except ValueError: exprl_0 = float(exprl[0]) except: return "type error" try: exprl_2 = int(exprl[2]) except ValueError: exprl_2 = float(exprl[2]) except: return "type error"...
bb7822993fc7631c55d7f712f3b6923ef24f46f1
CrisDeveloperRepo1/consultarEjercicios
/ejercicio10P2.py
690
3.625
4
str = ['im1','im2','im3'] cont=0 for i in str: print('ingrese') caracter= input() if cont==0 : str[cont] = i+" "+ caracter elif cont>1 and cont<=len(str)-1: while(-1 !=(str[cont-1].find(caracter)))or (-1 !=(str[cont-2].find(caracter))) : print('ingrese otra coord repetida') caracter=input() ...
4d39cd6dec885463ec12c8ba10ecd71ccf51adf0
andrew128/ShortestPathFinder
/Other/test/test.py
251
3.59375
4
# test casting point = '0,0'; point = point.split(","); print point print type(point) print point[0]; print type(point[0]) print int(point[0]) print type(int(point[0])); #a = '1'; #print a; #print type(a); #a = int(a); #print a; #print type(a);
46bfd0a5912993407c02d10e1778d2f1ad6aa9cb
HerrWolf/python
/clase21.py
143
3.546875
4
edad = 18 if edad >= 21: print ("puedes entrar y chupar") elif edad < 18: print("te la pelas putito") else: print("entrale pero chiton")
27d36a5f460bc3162a4fbfbe99d236a6d82113ef
lucas-silvs/Curso-Guanabara
/Mundo - 1/EX 32 - ano bissexto.py
186
3.921875
4
ano = int(input('Digite o ano:\n')) if ((ano%4==0 and ano%100==0 and ano%400==0) or (ano%4==0 and ano%100!=0)): print('O ano é bissexto') else: print('Não é um ano bissexto')
e8e3379e171da7f1912e93616e30120e76728dc9
rogert100x/Cyclepower
/cycling power tkinter.py
4,388
3.765625
4
# Bicycle power calculator from tkinter import * #create programs below def click(): try: #check for non numeric entries g=float(9.81)#gravity K1=float('0.0053') #Aero factor K2=float(Cd.get()) #Cd factor m=float(Rider_mass.get())+float(Bike_mass.get()) ...
f42b1880c8e86c8691813180aea8d2ea50836d6b
FrancescoPenasa/UNITN-CS-2019-LaboratoryOfComputerScienceEducation
/ESEMPI_TURTLE/FOR/color_spiral.py
309
3.8125
4
import turtle t = turtle.Turtle() s = turtle.getscreen() s.bgcolor("black") sides = 6 for x in range(0, 360, 10): t.width(x*sides/200) if(x < 120): t.pencolor("yellow") elif(x < 240): t.pencolor("orange") else: t.pencolor("red") t.forward(x * 3/sides + x) t.left(360/sides + 1) turtle.done()
67599388aabcd4eace9e8e3d5c64cdd13374201f
schae42/functions_intermediateI
/function_intermediateI.py
732
4.1875
4
# 1. print(randInt())     # should print a random integer between 0 to 100 import random def randInt(): print(int(random.random()*100)) randInt() # 2. print(randInt(max=50))     # should print a random integer between 0 to 50 import random def randInt2(): print(int(random.random()*50)) randInt2() #...
ddf1ab05e009891296c44e88acddacc12e31a378
WiseDemon/test_task
/src/exceptions/redis_command_parser_exceptions.py
1,843
3.515625
4
class RedisCommandParserException(Exception): """ Basic RedisCommandParser class exception """ pass class WrongCommand(RedisCommandParserException): """ Exception for wrong command given """ def __init__(self, msg=None): if msg is None: msg = 'Wrong command' ...
103fa423646104c0e66c69c33151ccfe4fbe812f
jaraco/tempora
/tempora/schedule.py
6,006
3.875
4
""" Classes for calling functions a schedule. Has time zone support. For example, to run a job at 08:00 every morning in 'Asia/Calcutta': >>> job = lambda: print("time is now", datetime.datetime()) >>> time = datetime.time(8, tzinfo=pytz.timezone('Asia/Calcutta')) >>> cmd = PeriodicCommandFixedDelay.daily_at(time, jo...
a1cf9670b0685979b2fdeb9c9691f710415ce0aa
syurskyi/Python_Topics
/125_algorithms/_exercises/templates/100_python_Best_practices_for_absolute_beginers/Project+68 How to fill List.py
307
3.765625
4
____ r__ _______ randint ___ list_fill(first, qyt, mini, maxi): ___ i __ r..(qyt): first.a..(randint(mini,maxi)) minimum i..(input("Insert minimum value: ")) maximum i..(input("Insert maximum value: ")) num i..(input("Number of elements: ")) x [] list_fill(x,num,minimum,maximum) print(x)
603652bb64cf9e6b878e0eec1be32f9084956d5a
brunozupp/TreinamentoPython
/exercicios/exercicio009.py
138
3.765625
4
if __name__ == '__main__': num = int(input("Digite um número = ")) for i in range(11): print(f"{num} x {i} = {num * i}")
7134a5cd600be4d81fa4540599aaee1c849272ce
monkeesuit/Intro-To-Python
/Examples/json_example.py
2,243
3.875
4
d = { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { ...
36a28a09b10f879238ac6b15cee345249fee4e2e
emreyurtbay/project-euler
/euler2.py
1,028
3.90625
4
# Project Euler Problem 2 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of...
41a9ca3f35a849923da2bac9173ef1736e3c166a
Prabishan/realPython
/book1/ch05/invest.py
300
3.765625
4
def invest(amount, rate, time): print("principle amount: ${}".format(amount)) print("annual rate of return: {}".format(rate)) for n in range(1,time+1): amount= amount*(1+rate) print("year {}: ${}".format(n,amount)) print("") invest(100,.05, 8) invest(2000, .025, 5)
44b3e7cf2316f291c39a89c1b1ee420690a8feeb
filipov73/python_fundamentals_september_2019
/07.Data Types and Variables - More Exercises/05. Balanced Brackets.py
394
3.546875
4
lines = int(input()) bracket_list = [] balanced = None while lines: text = input() if len(text) == 1 and (ord(text) == 40 or ord(text) == 41): bracket_list.append(ord(text)) lines -= 1 for i in range(0, len(bracket_list), 2): if bracket_list[i] == 40 and bracket_list[i+1] == 41: balanc...
37ce2b381894e9a2eaa65024bda2d0b1a697f021
namanjn98/sci-lit-IR
/normalise_names.py
3,909
3.5625
4
#Used to Normalise variations in Names #Just run the function two_word_name(input_list) #Input: #input_list = ['matin a', 'mat amit', 'ma a', 'matin r', 'matin amit', 'amit matin', 'amit matin', 'a matin'] #Output: #{'a ma': [2], 'amit matin': [0, 4, 5, 6, 7], 'mat amit': [1], 'r matin': [3]} #(Key - Normalised ...
c8bd5b541a5ad0a8660e1b369216d15b9e852f9d
nikhitha-r/Protein-Prediction
/Ex3/local_alignment.py
8,185
3.5
4
import numpy as np from tests.matrices import MATRICES class LocalAlignment: def __init__(self, string1, string2, gap_penalty, matrix): """ :param string1: first string to be aligned, string :param string2: second string to be aligned, string :param gap_penalty: gap penalty, intege...
eda917d73462f20e3f74b2292b1e73bd0eb24c85
liousAlready/NewDream_learning
/老师の课堂代码/day08/day08-异常处理.py
1,742
3.984375
4
''' @File : day08-异常处理.py @Time : 2021/5/9 11:28 @Author: luoman ''' # import lib # 异常:与错误区别 exception error # 为什么要处理异常:希望程序在出现问题时仍然能够继续运行 # 捕捉异常可以使用try/except语句。 ''' 形式一: try: 可能会出现异常的语句 except: 异常处理语句 else: 没有出现异常的时候执行 形式二: try: 可能会出现异常的语句 except: 异常处理语句 finally: 不管是否出现异常都会执行 ''' ''' for i...
725a15a7d53662f536d86247e728bd24bde7a014
iamrishav111/Plagiarism-and-Code-Similarity-Checker
/media/studentsubmission/files/cachepython_YIarDXT.py
787
3.859375
4
from datetime import datetime from matplotlib import pyplot as plt def create_int_list(size): int_list = [0] * size start_time = datetime.now() for i in xrange(64*1024*1024): int_list[(i * 16) % size] *= 1 end_time = datetime.now() elapsed = (end_time - start_time).microseconds del(int_list) return elapsed ...
de2d80e871560156248eab26edb5a4c84cd8ff70
selam-weldu/algorithms_data_structures
/miscellenous/data_structure_implementations/stack.py
675
3.78125
4
class Stack: def __init__(self): self.stack = [] self.length = 0 def append(self,data): self.stack.append(data) self.length += 1 return self def pop(self): if self.isEmpty(): return data = self.stack.pop() self.length -= 1 retur...
c59f63c613dc6828efca700f368f761d51d14447
Lee939202/EmotionalAnalysis
/情感词分析/nihe.py
1,139
3.5625
4
#导入各种需要的包# import numpy as np import matplotlib.pyplot as plt from scipy import optimize #定义所需要拟合的带参数的一般函数类型# def fmax(x,a,b,c): return a*np.sin(x*np.pi/6+b)+c ''' def func(x, a, b, c): return a * np.exp(-b * x) + c''' #输入数据# x=np.arange(1,13,1) x1=np.arange(1,13,0.01) #第1、2个参数为坐标范围的起始点和终止点,第3个参数为最小刻度# #这里的...
1e83f8dfaaafbbd7aca418082d5f0fd6173830c7
vinaybhosale/Python
/PythonBasics/MaxMin.py
508
4.03125
4
class MaxMinNumber: def sortmaxmin(list): max_num = list_data[0] min_num = list_data[0] for element in list_data: if element > max_num: max_num = element if element < min_num: min_num = element print("Maximum number : " , max_n...
007edb3fc1a5d0642b7cd22678e83e4ec0299b34
ayushkumar-25/PracticePrograms
/New folder/swap.py
376
3.875
4
a =[] def swap_case(s): for i in s: if (i>='A' and i<='Z'): a.append(i.lower()) elif (i>='a' and i<='z'): a.append(i.upper()) else: a.append(i) s = input() swap_case(s) print(a) st = "".join(a) print(st) '''if __name__ == '__main__': s =...
bee9817ae26e24ad8b00a5dad5d6ee9e9fbd9cc1
CianLR/CA117-LabProblems
/Lab10.1/minimum_101.py
150
3.53125
4
def minimum(l): if len(l) == 1: return l[0] else: min_ret = minimum(l[1:]) return l[0] if l[0] < min_ret else min_ret
cb67072f72329793df5d6234d804d6be14004da0
coprobo/DaftCode_Python
/zajęcia nr 4/zadanie domowe nr 4/Zad1.py
1,820
3.625
4
# Zaimplementuj klasę Date, która tworzona jest na podstawie trzech wartości - day, month i year. # Obiekt klasy powinien zawierać atrybuty day, month i year # Twoim zadaniem jest sprawdzenie w trakcie tworzenia obiektu, czy podane wartości są poprawne: # jeśli year nie jest intem - rzucić InvalidYearError # jeśl...
05be53e2c3918ae371eb8fa0e2b9403c7337854c
dvida/QueuedPool
/QueuedPool.py
7,201
3.921875
4
from __future__ import print_function import multiprocessing import time class SafeValue(object): """ Thread safe value. Uses locks. Source: http://eli.thegreenplace.net/2012/01/04/shared-counter-with-pythons-multiprocessing """ def __init__(self, initval=0): self.val = multiprocessing....
6ecb872f1e2a6e9ffedf066361ccb1cebc7b196b
mag389/holbertonschool-machine_learning
/math/0x07-bayesian_prob/0-likelihood.py
1,301
3.671875
4
#!/usr/bin/env python3 """calculating likelihood """ import numpy as np def likelihood(x, n, P): """ calculates likelihood of obtaining data gien probabilities x: number of patients that develop sideeffects n: total patients P: 1D np.ndarray of various hypothetical probs of deving sideeffe...
382e6a7d273d6d3b5af4808e8bda479a90ed9fa7
theromis/mlpiper
/mlops/parallelm/mlops/stats/health/categorical_hist_stat.py
3,798
3.640625
4
""" The Code contains functions to calculate univariate statistics for categorical features, given a dataset. """ import numpy as np from parallelm.mlops.stats.health.histogram_data_objects import CategoricalHistogramDataObject class CategoricalHistogram(object): """ Class is responsible for providing fit ...
6d38b2f91ad2aeeb89d25e2d49988b3d102ade90
tonygomo/instilled-code-challenge
/test.py
1,904
3.59375
4
import unittest from main import InvalidInputError, parse_fragments, calculate_uvt class TestParseFragments(unittest.TestCase): def test_parse_strings(self): """It should parse correctly formatted strings.""" parsed = parse_fragments('0-1000', '1500-2000') self.assertEqual(parsed, ...
b131cb396cc759b3e5ec2d16c9ef3aabb9672309
mistrydarshan99/Leetcode-3
/binary_search/find_smallest_element_larger_than_target.py
756
4
4
""" problem: find the smallest number in the nums that is larger than target. """ def find_smallest_num_larger_than_target(nums, target): """ inputs: nums: list[int] target: int output: int """ if not nums: return -1 l = 0 r = len(nums) - 1 while l < r: mid = (l + r) // 2 prin...
29582bbfd21788f9d4a62ab99b4f133d0d6ca510
abeoliver/Deep-Notakto
/deepnotakto/agents/agent.py
4,231
3.5625
4
####################################################################### # Can Deep Reinforcement Learning Solve Misère Combinatorial Games? # # File: agents/agent.py # # Abraham Oliver, 2018 # ################################...
5d1c509626145b7496c86663bfe0f0255afaf64b
swaggy420/Programming-Portfolio2015
/pypet.py
974
3.609375
4
print 'Welcome to Pypet!' name = ' Jerry' age = 6 weight = 1.5 hungry = False photo = '<:3 )~~~~' print 'Hello' + name print photo mouse = { 'name': ' Jerry', 'age': 6, 'weight': 1.5, 'hungry': False, 'photo': '<:3 )~~~~', } name = ' Tom' age = 5 weight = 9.5 hungry = False photo = '(=^o.o^=)__' cat = { 'na...
971a31192ae83c0a09962b5ad4272816e9230cf2
east4ming/pyEdu
/day09/plus_minus.py
1,252
4.0625
4
"""简单的加减法数学游戏. 1. 随机生成两个100以内的数字 2. 随机选择加法或剑法 3. 总是使用大的数字减去小的数字 4. 如果用户打错三次, 程序给出正确答案 """ from random import randint from random import choice def gen_two_nums(): """随机生成两个100以内的数字""" num1, num2 = randint(1, 100), randint(1, 100) return num1, num2 def caculate(num1, num2): """""" operator = cho...
40d7de12c668e463394478a552103923ff546416
JoTaijiquan/Python
/Python101/1-10/1-1002.py
540
3.640625
4
#Example 10.02 #Python 3.7.1 import turtle def example_1002(): ts = turtle.Screen() turtle.pencolor("RED") turtle.forward(100) turtle.left(90) turtle.forward(100) ts.mainloop() example_1002() ''' turtle.pencolor("RED") เปลี่ยนปากกาเป็นสีแดง turtle.forward(100) เดินหน้า 100 หน่วย tur...
ff11c8199f423cacef5e0c72ee94a8b841a3712b
heechul90/study-python-basic-1
/Python_coding_dojang/Unit 08/Bool2.py
1,394
4.0625
4
### Unit 8. 불과 비교, 논리 연산자 알아보기 ## 8.2 논리 연산자 사용하기 # a and b print(True and True) print(True and False) print(False and True) print(False and False) # a or b print(True or True) print(True or False) print(False or True) print(False or False) # not x print(not True) print(not False) print(not True and False or not F...
185a5c46e5448766430e8fb2dbd28b62777f5071
jeff87b/Python-module-1
/Day 6-10/Day 8/04 Calculate leap year.py
684
4.125
4
def isLeapYear(year_entered): check_divisible_by_4 = year_entered % 4 check_divisible_by_100 = year_entered % 100 if check_divisible_by_4 == 0 and check_divisible_by_100 != 0: print("Yes it's a leap year") elif check_divisible_by_4 == 0 and check_divisible_by_100 == 0: check_divisible_b...