blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
c0e19a26d946526b9fee4dd955ad24170ffb15eb
Nana-Antwi/UVM-CS-21
/delete.py
441
3.984375
4
#delete entry delete_entry = input('Do your wish to delete database save on your account yes/no: ') if delete_entry == 'yes': os.remove(account_file) print('Your account and entry has been deleted') print('Thanks for being a valued user of the Music Legend!') elif delete_entry == 'no': print('Your databa...
5dc6d1d7a6fd1afddcf85beeaf6786d4c0e7bcf1
Nana-Antwi/UVM-CS-21
/g.py
2,455
3.859375
4
#Nana Antwi #CS 21A #Assignment 7 #grades.py #design a program that write an inputfile to an outfile with a different file name. def main(): # declare variables grades = ' ' letters = ' ' grade_value = ' ' grade = 0 letter_value = ' ' a = 'A:' b = 'B:' c = 'C:' d...
0f4209f6a4b1dd0b38d661e25e21dee9e8b2c3b9
Nana-Antwi/UVM-CS-21
/try10.py
553
3.9375
4
#Nana Antwi #CS-21 #Assignment 3 #Question 5 #Design a program that give secondary colors or invalid combinations #Declare Constants red = red blue = blue yellow = yellow #variables primary_1 = (input('Enter first primary color: ') if primary_1 == red and primary_1 == blue : ...
bd4281ad311cf0618d29db6245e837d88fbe46d6
Nana-Antwi/UVM-CS-21
/home2.py
587
4.09375
4
#Nana Antwi #CS 021 #Assignment 6 #primes.py #Design a program that tells if a number is prime or not. #prime number list function import math def main(): for num in range(1,101): if is_prime(num) == True: print(num, end=" ") #function for determining prime numbers def is_pri...
bd3165c739c36a1cb0fecb813eeaf6626cb754de
Nana-Antwi/UVM-CS-21
/character1.py
1,023
3.90625
4
#assignment 9 #charater analysis #design a program that reads the contents of a file to user. #define main fuction def main(): #user prompt input statement read_file = input('Enter the filename you wish to display its contents:') #open an input file inputfile = open(read_file,'r') #read conten...
fda9f35b5f9acc797cda925b16f2e8de98b0fd88
Nana-Antwi/UVM-CS-21
/classdemo.py
199
4.25
4
#define a program for even or odd integers #define variables x = int(input("Enter a number:")) if x % 2 == 1 : print('The number is odd') else: print('The number is even')
9d44df3ad84744af06d02d53553f0049c382f2d2
Nana-Antwi/UVM-CS-21
/distance.py
799
4.125
4
#Nana Antwi #cs 21 #assignment 4 #distance.py #write a program that calculates distance #distance is equal to speed muliple by time #variables speed = 0.0 time = 0.0 distance = 0.0 var_cons = 1.0 #user input variable speed = float(input('Enter speed: ')) #user prompts #condition loop statements wh...
7b8e2152037ecb9b7514ed628c4829f39c1f47cc
Nana-Antwi/UVM-CS-21
/demo3.py
1,283
3.6875
4
#Nana Antwi #CS 21 #assignment 4 #design a program for analysing budget #asisgn variables budget = 0.0 spent = 0.0 total = 0.0 surplus_budget = 0.0 negatve_budget = 0.0 SENTINEL = 0.0 #user prompt inputs budget = float(input('Enter total budget for the month: ')) spent = float(input('Enter an amount sp...
8a128a6aa83ca41090340a4ae4d076c742295eb9
Nana-Antwi/UVM-CS-21
/charge_acc.py
1,850
3.96875
4
#Nana Antwi #CS 21 #Assignment 8 #Design a program that prompts a user for an account number which it evalutes to identify if is part of a list of accounts #define main function def main(): #declare variables myfile = 0.0 t = 0 f = 0 charge_account = 0 ...
b3b6836ee47ca208261f0cfab2a9adf30ca04c22
Nana-Antwi/UVM-CS-21
/project2.py
10,685
4.1875
4
#project #all hands on deck #musicdatabase.py #Design a program that prompt users to create account of a collection of information to be stored and returned. #define main function def main(): #output statements print('The Music Legend Program!') #user prompt input statements ...
d68964f4a88281917897733404544d8b9778f619
jonassjoh/projecteuler
/problem_8/product.py
329
3.5
4
number = '' with open('number.in') as f: for line in f: number += line.strip() def product(a): a_s = 1 for p in a: p = int(p) a_s *= p return a_s chunk = 13 s = 0 for i in range(len(number) - 1 - chunk): a = number[i:i+chunk] p = product(a) if p > s: s = p ...
0c2bc2ff035678d3f8d947124c05d6293a0c7da0
rynoV/andrew_ng-ml
/mongo-lin-reg/src/computeCost.py
790
4.3125
4
import numpy as np def computeCost(X, y, theta): """ Compute cost for linear regression with multiple variables. Computes the cost of using theta as the parameter for linear regression to fit the data points in X and y. Parameters ---------- X : array_like The dataset of sh...
e6dcd8ab1a9457837b5227cf6a8b7e63dcc5cbb7
natthanun1999/PlayFair
/PlayFair.py
9,566
3.546875
4
characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] pairs_letters = [] cipher_text = [] decrypt_text = [] # Square Table [5 x 5] rows = 5 cols = 5 table = [[0 f...
9e80ea6954c86be632221d427e17da8a0a84f670
efrainc/project_euler
/problem11.py
3,899
4.03125
4
def grid_max(g): """find the max value searching right, up, and diagaonally""" max = 0 max = up(g, max) max = right(g, max) max = diag(g, max) return max def right(g, max): """find the max value searching right to left""" n = len(g[0]) - 3 for l in g: for m in xrange(n): ...
6320c4af09b3247e74032dcc2726a6f710eef294
efrainc/project_euler
/problem12.py
1,824
4
4
#! /usr/bin/env python import time def factorial(num): """Find list of unique factors for a number""" l = [] for i in xrange(1, (int(num**0.5) + 1), 1): if num % i == 0: l += [i] + [num/i] return len(set(l)) def factorial2(num): """Testing with appened method for time of ex...
2f6468c2eaccae8c8de394b87e00eb59a7f23757
efrainc/project_euler
/problem13.py
487
3.953125
4
#! /usr/bin/env python if __name__ == '__main__': """Pretty Self Explanitory - but for completeness reads the file line by line. Converts each line into an int and add the int to a cummulative sum""" a = open('problem13_input.txt', 'r') output = 0 for line in a: output += int(line) ...
7b7df22e8c06d15dd0ab97edeef359778c773e61
leliel12/talks
/scipyla2016/sqlalchemy/sqlalchemy_tutorial/04_orm_adv.py
7,242
3.6875
4
### slide:: ### title:: Advanced Object Relational Mapping # start with the same mapping as before... from sqlalchemy import Column, Integer, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True...
24b6b5545db5d9c37271581e826e3ab7691314a2
odajunpei/python2-
/Desktop/python2年生/chap3/chap3-4.py
354
3.65625
4
import pandas as pd #csvファイルを読み込む df = pd.read_csv("test.csv") #1行のデータを表示 print("c子のデータ\n",df.loc[2]) #複数行のデータを表示 print("C子とD郎のデータ\n",df.loc[[2,3]]) #指定した行の指定した列のデータを表示 print("C子の国語データ\n",df.loc[2]["国語"])
3876ab5e3b649a2c27c6d6efd81f3ee3041550b4
odajunpei/python2-
/Desktop/python2年生/chap3/chap3-3.py
268
3.640625
4
import pandas as pd #csvファイルを読み込む df = pd.read_csv("test.csv") #1列のデータを表示 print("国語の列データ\n",df["国語"]) #複数の列のデータを表示 print("国語と数学の列データ\n",df[["国語","数学"]])
509f8f3a9c18d53876d9dc60d7b68a0d1f7d42bf
EvanBuelt/Hearts
/CardEngine/VectorMath.py
15,216
4.40625
4
import math __author__ = 'Evan' class Point2D(object): """ This class represents a 2D point in space. Uses several methods to translate, rotate, scale, and reflect the point in space """ def __init__(self, x, y): """ Initializes the point class with x and y coordinates as floating...
d37f2906eb1d043e1a7bd0b42bd8ea44d4f81628
EvanBuelt/Hearts
/CardEngine/Base_UI.py
4,257
3.6875
4
import pygame import CardEngine.Engine __author__ = 'Evan' class _InheritanceError(Exception): """ Inheritance Error is used to ensure certain class methods are inherited. """ def __init__(self, value): """ :param value: Message to be displayed when error is raised :return: ...
d353c9e2a60490a55084ea65872d4ea3b5013e38
LuizArthur/design-patterns-python
/factory-pattern/circle.py
96
3.5
4
from shape import Shape class Circle(Shape): def draw(self): print('Inside Circle')
93008e506b13167ff3a4079fc23211d59634f486
tanmaysharma015/Tanmay-task-3
/Task3_Tanmay.py
399
3.59375
4
import pandas as pd travel = pd.read_csv("first_years_dataset_2.csv") type(travel) field_age = travel['Age'] field_age = field_age.apply (pd.to_numeric, errors='coerce') #for dropping all the elements with NaN values field_age = field_age.dropna() print("dataset with no NaN value in Age column: ") print(field_a...
8232f3924a4fbcb0e84552b8b024f35acab22618
bskanes/TextAdventure
/Game.py
37,300
3.515625
4
import random def enter(): input('\033[91mPress Enter') def error(): print('\033[91minvalid input') input('\033[91mPress Enter') # Enemy's goblin_one_stats = {'Health': 20} goblin_one_attack = (random.randint(1, 3)) gorbo_stats = {'Health': 25} gorbo_attack = (random.randint(1, 5)) satans_pooch_sta...
b9cbe33b6c56b7588ed7313a90f41f8e14bd9c72
khanshyamsundar/DataScience-Assignments
/src/session5/session5Assignment2.py
912
4.0625
4
# Problem​ ​Statement​ ​1: # Implement a Python program to generate all sentences where subject is in # ["Americans", "Indians"] and verb is in ["Play", "watch"] and the object is in # ["Baseball","cricket"]. # Hint: Subject,Verb and Object should be declared in the program as shown below. # subjects=["Americans ","Ind...
65398287bbf6ee357c154ced292f06b5d3070e9b
khanshyamsundar/DataScience-Assignments
/src/session11/session11Assignment1.py
1,391
4.03125
4
# This assignment is for visualization using matplotlib: # data to use: # url= # https://raw.githubusercontent.com/Geoyi/Cleaning-Titanic-Data/master/titanic_original.csv' # titanic = pd.read_csv(url) # Charts to plot: # 1. Create a pie chart presenting the male/female proportion # 2. Create a scatterplot with the Fare...
998a4f6abb42c12e8b35a9a5df6cb3255a50b482
manojkumar00158/python_training_deepaksir
/get_method_exercise.py
2,081
3.953125
4
#1.get method using keys to get values def get_function(): dict_1 = {"fruit1" : "apple" , "fruit2" : "mango"} print(dict_1.get("fruit1")) get_function() #2 def get_function2(): dict_2 = { "name" : "vishwanath anand", "occupation" : "chess GM" } print(di...
2a84fde9734f92965d0545bb3dd0fb0a6b06a190
ClaudiaMoraC/Ciclo1_Python
/Clase11junioListas_Tuplas.py
2,106
4.15625
4
# thislist = ["apple", "banana", "cherry"] # print(thislist) # Longitud de lita # thislist = ["apple", "banana", "cherry"] # print(len(thislist)) #tipo # mylist = ["apple", "banana", "cherry"] # print(type(mylist)) #Acceder a un elemento de la lista # thislist = ["apple", "banana", "cherry"] # print(thislist[1]) # p...
c88708c95b1f717bcf04e77d9a4eb06aca5724cc
ClaudiaMoraC/Ciclo1_Python
/ejerciciosSemana2.py
1,282
3.96875
4
# Leer un número entero y determinar si es un número terminado en 4. # entero=input("Escribe un número entero de 4 digitos: ") # #print(list(entero)) Lista el numero ingresado # a=int(entero[3])# toma la ultima posicion del numero de 4 digitos # if a==4: # print("El número ",entero," termina en 4") # else: # ...
f9d7cead3ebc84aa3dad82ca5b2d851f282faa69
ClaudiaMoraC/Ciclo1_Python
/RetoClase19mayo.py
3,071
3.921875
4
# 1. Leer un número entero y determinar si es un número terminado en 4. # entero=input("Escribe un número entero de 4 digitos: ") # #print(list(entero)) Lista el numero ingresado # a=int(entero[3])# toma la ultima posicion del numero de 4 digitos # if a==4: # print("El número ",entero," termina en 4") # else: # ...
4b4ba1682783b815e0e69397f7254a96022ba27d
rahuljnv/Python_Tutorial_rg
/T5_If_Else_Loop_Break_Continue.py
1,998
4.0625
4
# L1 # IF Else ladder # var1 = 6 # var2 = 45 # var3 = int(input()) # NOT efficient if "if" cond'n will get true then, it will check all if # if var3 > var2: # print("Greater") # # if var3 == var2: # print("Equal") # # else: # print("Smaller") # # here, if 'if' will get true then, will execute the block ...
d7c54bb794a1700ba5f94159daa07bd72dcbe3ed
rahuljnv/Python_Tutorial_rg
/E7_Kirana_Store.py
475
3.78125
4
# E7- write a python program to generate kirana Bill sum = 0 while True: userInput = input("Enter the price or press 'q' to quit\n") try: if userInput != 'q': sum = sum + int(userInput) print(f"your Amount so for:{sum}") elif userInput == 'q': print(f"Your Total am...
7a2aba24cf92a368bdeef9eae3951420627c2830
nazomeku/miscellaneous
/fizzbuzz.py
489
4.375
4
def fizzbuzz(x): """Take integer and check if it is divisable by: 3: return 'fizz', 5: return 'buzz', 3 and 5: return 'fizzbuzz', otherwise: return input as string. Args: x: The integer for which the condition is checked. Returns: Corresponding string value. """ if x ...
70be9010a0875d1b7d14a53eacb2a3432dd0221a
nazomeku/miscellaneous
/factorials.py
379
3.75
4
def rFactorial(x): """Recursive take on factorial computing problem.""" if x in (0, 1): return 1 else: return x * rFactorial(x-1) def iFactorial(x): """Iterative take on factorial computing problem.""" if x in (0, 1): return 1 else: result = 1 for i in ra...
dbce30fef9cf62636f0cf8f286930108e66bf12c
CaminoaFederico/Python
/Ejercicio1.py
151
3.703125
4
cant_alum = int(input("Ingrese la cantidad de alumnos presentes")) if cant_alum == 7: print("Todos presentes") else: print("Falta gente")
cc79f38420b39113f7d988a6171bdf3fd6f27e2d
UmmadisettyRamsai/ramsai
/labprogramme2.py
1,140
4.46875
4
# basic operations on single array #A PYTHON PROGRAM TO PERFORM UNIARY OPERATIONS import numpy as np a = np.array([1, 2, 5, 3]) # add 2 to every element print ("Adding 2 to every element:", a+2) # subtract 3 from each element print ("Subtracting 3 from each element:", a-3) # multiply each element b...
ab7ef4dd24c0e21a857cd1a8c28c9fdb36739169
Psycadelik/sifu
/general/is_integer_palindrome.py
486
4.15625
4
""" Check Whether a Number is Palindrome or Not Time complexity : O(log 10(n)). We divided the input by 10 for every iteration, so the time complexity is O(log10(n)) Space complexity : O(1) """ def is_palindrome(num): original_num = num reversed_num = 0 while (num != 0): num, rem = divmod(num, ...
d6f6ffe970bc07cb80de32bd540435ec6ee22652
saichaitu92/assesment-4
/p2a3.py
168
3.65625
4
def p(r): p=float(2*r*3.14) print ("circumfrence is ",p) def a(r): a=float(3.14*r*r) print("area:",a) r=float(input("radius")) p(r) a(r)
55a971368c1ab6992f21959a1972b253a60423b5
chain2future-os/future-core-scripts
/tests/hello_test.py
549
3.59375
4
#coding=utf-8 import unittest class TestHello(unittest.TestCase): # 该方法简单地返回字符串 def say_hello(self): return "Hello World." # 计算两个整数的和 def add(self, nA, nB): return nA + nB # 测试say_hello函数 def test_a1_say_hello(self): self.assertEqual(self.say_hello() , "Hello World.") ...
3d35a47c2017a99d3348a981232814b68c0de683
smoothie0000/ALNS
/Heuristic Solution/destroy.py
1,464
3.5
4
import tsplib95.distances as distances degree_of_destruction = 0.25 def edges_to_remove(state): return int(len(state.edges) * degree_of_destruction) def worst_removal(current, random_state): """ Worst removal iteratively removes the 'worst' edges, that is, those edges that have the largest distance....
4c644035303cbd3981be155f5b240900b242f830
cclient/linux-management
/python/for
234
3.78125
4
#!/usr/bin/env python l1 = ['b','c','d','b','c','a','a'] l2 = [] for i in l1: if not i in l2: l2.append(i) print l2 等价于 l1 = ['b','c','d','b','c','a','a'] l2 = [] [l2.append(i) for i in l1 if not i in l2] print l2
0c0f5171dcb7c60c9c52278b9d4c396e0fe2f710
FoysalAhmad/PythonAutomation
/backuptoZip.py
982
3.828125
4
#!usr/bin/env #backuptoZip.py - copies an entire folder and its contents into a # ZIP file whose filename increments import zipfile,os def backupToZip(folder): folder = os.path.abspath(folder) # make sure folder is absolute number =1 while True: zipFilename = os.path.basename(folder)+'_'+str(number)+'.zip' ...
2f6ff70b7c106c50b71e7d4f55b6fcd13a8d23cb
FoysalAhmad/PythonAutomation
/whatdayitwas.py
172
3.96875
4
import time import datetime day = raw_input('Enter date (format:mm/dd/yyyy):\n') dayFormat =datetime. datetime.strptime(day,'%m/%d/%Y') print(dayFormat.strftime('%A'))
00f27c7e929261bb1f27820d93d7788d8995e91c
egewarth/uri
/1012.py
289
3.703125
4
i=input().split() a=float(i[0]) b=float(i[1]) c=float(i[2]) pi=3.14159 print("TRIANGULO: {0:.3f}".format((a*c)/2)) print("CIRCULO: {0:.3f}".format((pi*(c**2)))) print("TRAPEZIO: {0:.3f}".format(((a+b)*c)/2)) print("QUADRADO: {0:.3f}".format(b**2)) print("RETANGULO: {0:.3f}".format(a*b))
07c22ce083e2775e9c5c021ec90f138d07f9d2be
egewarth/uri
/1014.py
66
3.75
4
a=int(input()) b=float(input()) print("{0:.3f} km/l".format(a/b))
6865ebcf553332c55a638d1f07df6d4d74532d1a
raghavthakur007/pongproject
/python_programs/three digit loocha.py
177
4.25
4
num = int(input("Enter your three digit number")) rem= num%10 num = int(num/10) rem = rem*(num%10) num = int(num/10) rem =rem*(num%10) num= num/10 print("The number is :",rem)
7ff41f79067ccf9b0dadaa4c88d548336b534433
MPeteva/HackBulgariaProgramming101
/Week0/1-PythonSimpleProblemsSet/T16_BiggestDifference.py
322
3.75
4
def biggest_difference(arr): if len(arr) == 0: return False max_element = arr[0] min_element = arr[0] for element in arr: if max_element < element: max_element = element if min_element > element: min_element = element return min_element - max_elemen...
3095f73812b0bce382a5634ec70fb99ac26fd4ae
MPeteva/HackBulgariaProgramming101
/Week0/1-PythonSimpleProblemsSet/T8_ContainsDigit.py
353
3.953125
4
def contains_digit(number, digit): string = str(number) char = str(digit) if char in string: return True return False def main(): num = int(input("Input a number: ")) digit = int(input("Input a digit to check if the number contains it: ")) print (contains_digit(num, digit)) if __...
1f3533dc0dd324766f4e7d39681dbdf434ad0d4d
MPeteva/HackBulgariaProgramming101
/Week0/1-PythonSimpleProblemsSet/T11_CountSubstrings.py
330
4.25
4
def count_substrings(haystack, needle): count_of_occurrences = haystack.count(needle) return count_of_occurrences def main(): String = input("Input a string: ") Word = input("Input a word to count occurrences of it in string: ") print (count_substrings(String, Word)) if __name__ == '__main__': ...
b215f0507d36d11878a93959c43e7b8b5fbc4844
MPeteva/HackBulgariaProgramming101
/Week0/2-PythonHarderProblemsSet/T1_count_words.py
374
4.0625
4
def count_words(arr): count_of_words = {} for word in arr: # trqbva da sloja chek ako veche e vkarana edin put dumata v dictionary da ne q vkarva vtori put # trqbva da si dobavq proverki za prazen i za chisla (eventualno) count_of_words[word] = arr.count(word) return count_of_words print ...
0dce1e5d9401b884944318c1e7f9b125d8c3aafc
plectrum0224/Python
/PycharmProjects/OOP/Chapter7/dict_tuple_Parse.py
1,431
3.546875
4
#!/usr/bin/env python # encoding: utf-8 """ @version: ?? @author: Dave @contact: plectrum@outlook.com @software: PyCharm Community Edition @file: dict_tuple_Parse.py @time: 2016/2/9 10:15 """ from collections import namedtuple Book = namedtuple("Book", "author title genre") books = [ Book("Pratchett"...
498bd98efe5bc40ca463723dd38976bb28d684d5
plectrum0224/Python
/PycharmProjects/OOP/test002.py
1,294
3.875
4
# encoding: utf-8 # 钻石继承父类被多次初始化是个非常难缠的方法 class Base(object): def __init__(self): print "Base init" # # 普通方法 # class Medium1(Base): # def __init__(self): # Base.__init__(self) # print "Medium1 init" # # class Mediun2(Base): # def __init__(self): # Base.__init__(self) # ...
6cf02600c0578938f11b5a5913f1acea652a6de5
VitcSS/Eletromag
/campo.py
3,386
3.984375
4
import math class Point: def __init__(self, x, y): self.x = x self.y = y class Vetor(object): """ Classe representando um vetor de força elétrica """ def __init__(self, init_p, end_p, module = None): self.xi , self.yi = init_p.x, init_p.y self.xf , self.yf = en...
de7d4a05d1f184cbf6ed54cb286651ee42301a8b
GREENFONTS/python-challenge-solutions
/GodwillOnyewuchi/Phase 1/Python Basic 2/day 5 task/task 2.py
239
4
4
num1 = int(input("Enter a number: ")) num2 = int(input("Enter a number: ")) if num1 > num2: smaller = num2 else: smaller = num1 for i in range(1, smaller + 1): if num1 % i == 0 and num2 % i == 0: HCF = i print(HCF)
406aee47a18e697b5f4369f9a78c88d3216d0f69
GREENFONTS/python-challenge-solutions
/GodwillOnyewuchi/Phase 1/Python Basic 2/day 3 task/task 7.py
342
4.0625
4
import math Number = int(input("Enter a number: ")) if Number in range(0, 100): print("Number is in numbers 0-100") elif Number in range(100, 1000): print("Number is in numbers 100-1000") elif Number in range(1000, 2000): print("Number is in numbers 1000-2000") else: print(" Number is not...
325dc781196f8fcb3eea7b9aa2a3294757d1664a
GREENFONTS/python-challenge-solutions
/GodwillOnyewuchi/Phase 1/Python Basic 2/day 4 task/task 2.py
137
3.78125
4
lists = [2, 3, 4, 5, 6, 4, 4, 5, 8] count = 0 for i in lists: if i == 4: count += 1 print(f'Number 4 appeared {count} times')
31973c7e69d65484d3cf37b7317b97c9e875d171
GREENFONTS/python-challenge-solutions
/GodwillOnyewuchi/Phase 1/Python Basic 2/day 3 task/task 2.py
160
4.0625
4
import calendar month = int(input("Enter the month: ")) year = int(input("Enter the year: ")) Calendar = calendar.month(year, month) print(Calendar)
1a2127d8b44c48ec25c13dd7e26b26e85ae403fb
MatheusGG/Python_CursoEmVideo_Mundo01
/ex019.py
386
3.59375
4
from random import choice aluno1 = str(input('\033[4;36mDigite o nome do primeiro aluno: ')) aluno2 = str(input('Digite o nome do segundo aluno: ')) aluno3 = str(input('Digite o nome do terceiro aluno: ')) aluno4 = str(input('Digite o nome do quarto aluno: ')) lista = [aluno1, aluno2, aluno3, aluno4] print('O alu...
f870e3be46b3c9a2f8394bd33f40034e8b984223
MatheusGG/Python_CursoEmVideo_Mundo01
/ex005.py
175
3.9375
4
n1 = int(input('Digite um número: ')) antecessor = n1 - 1 print('\033[34mAnalisando o valor {}:\nSeu antecessor é {};\nO sucessor é {}.'.format(n1, antecessor, (n1+1)))
25e89f35aba79f89b64e87d6733c915957920f08
MatheusGG/Python_CursoEmVideo_Mundo01
/ex014.py
212
3.640625
4
celsius = float(input('\033[35mInforme a temperatura em °C: ')) fah = 9 / 5 * celsius + 32 kel = celsius + 273.15 print('A temperatura de {:.1f}°C correnponde a {:.1f}°F e {}K!'.format(celsius, fah, kel))
b57e37b2fe0df4554f6cc2347a25d206f038c610
MatheusGG/Python_CursoEmVideo_Mundo01
/ex016.py
148
3.546875
4
from math import trunc num = float(input('\033[1;41mDigite um número: ')) print('O número {} tem a parte inteira {}.'.format(num, trunc(num)))
a4cbcb91b49cb625c88877c58e18bac6efd05b98
felipe-pi/curso-python-senac
/pessoa.py
575
3.640625
4
class Pessoa(): nome = "" endereco = "" idade = 0 nome_mae = "" nome_pai = "" def __init__(self, nome, nome_mae, nome_pai=None):# init é um contrutor - None dado "null" self.nome = nome self.nome_mae = nome_mae self.nome_pai = nome_pai def dormir(self): ...
54139201140f0d140d575c8ce520170aef8f0872
jgrynczewski/Pytwwa5_design_patterns
/patterns/builder/builder/abs_computer.py
398
3.5
4
import abc from computer import Computer class AbsComputer(abc.ABC): def get_computer(self): return self._computer() def new_computer(self): self._computer = Computer() @abc.abstractmethod def get_case(self): pass @abc.abstractmethod def get_mainboard(self): ...
5445bd1df1895ec3906c10d5362b51d138400726
benjamin0905883618/goCode_LeetCode
/Day_5.py
2,838
4.40625
4
""" 這道題目曾出現在 Uber 的面試中。 給定一個 linked list 的 head node, 刪除所有總和為 0 的 sub linked lists, 直到此 linked list 不存在一個總和為 0 的 sub linked list 為止, 最後 return 刪除後的 linked list head node。 Example 1: Input: 3 -> 2 -> 1 -> -1 -> -2 -> None Output: 3 -> None Explanation: Sub list 2 -> 1 -> -1 -> -2 的總和為 0, 所以可把此 su...
2966347deb5a7c2b0551603724091a593e6c4568
benjamin0905883618/goCode_LeetCode
/Day_3.py
3,048
4.09375
4
""" 這道題目曾出現在 Facebook 的面試中。 給定 Binary Tree 的根節點 root, 找出此 Binary Tree 的最大寬度。 Binary Tree 的寬度定義為: 在某個 tree level 中,最左邊的節點至最右邊的節點的距離 若中間包含空節點 (null node) 則必須將空節點也納入距離的計算 Constraints: 節點值均為整數 最大寬度不會超過 32-bit integer 的可表示範圍 Input: binary tree = Level 0 9 (root) ...
15836a7c158c46605a536ab7b889119eed45fe7b
SaudiWebDev2020/Sumiyah_Fallatah
/Weekly_Challenges/python/week5/wee5day3.py
2,632
4.3125
4
# Create a queue using 2 stacks. A hint: stack1 will hold the contents of the actual queue, stack2 will be used in the enQueueing # Efficiency is not the goal! # Efficiency is not the goal! # Efficiency is not the goal! # The goal is to practice using one data structure to implement another one, in our case Queue from ...
6e8ab3ffa4a6fd27c8fddcf4079d78a002ae9e1c
SaudiWebDev2020/Sumiyah_Fallatah
/Weekly_Challenges/python/week3/testing_python.py
500
3.9375
4
my_list=[] print(type(my_list)) my_list.append(6) my_list.append(2) my_list.append(5) my_list.append(4) print(my_list) # def fun(): # pass print ("Hello Python") ob2 = { "name": "Zaphod", "numHeads": 2 } ob3 = {} for x in ob2: ob3[ob2[x]] = x print(ob3) ######### name = "Zen" print("My name is " + name +4...
b39ae58201a8341570504157032e26de2f232290
SaudiWebDev2020/Sumiyah_Fallatah
/Weekly_Challenges/python/week5/week5day2.py
1,065
3.609375
4
# Queue - FIFO # ------------------------------------------------ # Front # ------------------------------------------------ # Create slQueue method front() to return the value at front of our queue, without removing it. # Is Empty # ------------------------------------------------ # Create slQueue method isEmpty() t...
d7e6d356541db684eb3157ed6e2c6bf9bb435cc6
ton4phy/hello-world
/Python/22. Variables.py
204
3.796875
4
# Exercise # Find an undeclared variable in the program and declare it assigning the value ‘Dragon’ to it. family = 'Targaryen' # BEGIN pet = 'Dragon' # END print(family) print(' and ') print(pet)
c059e02dfe1f9c556b82de12ee26cd89a810db93
ton4phy/hello-world
/Python/55. Logic.py
253
4.28125
4
# Exercise # Implement the flip_flop function, which accepts a string as input and, if that string is 'flip', # returns the string 'flop'. Otherwise, the function should return 'flip'. def flip_flop(arg): return 'flop' if arg == 'flip' else 'flip'
ca71548c786da72de4c83531cdba7a5d8e6f3519
ton4phy/hello-world
/Python/57. Cycles.py
379
4.3125
4
# Exercise # Modify the print_numbers function so that it prints the numbers in reverse order. To do this, # go from the top to the bottom. That is, # the counter should be initialized with the maximum value, # and in the body of the loop it should be reduced to the lower limit. def print_numbers(n): while n > 0:...
4ec1706adfd8d6b7a3bb284a91bcf6f3afa5bc42
ton4phy/hello-world
/Python/52. Logic.py
375
3.96875
4
# Exercise # Implement the guess_number function that takes a number and checks if the number is equal to the given one (let it be 42). # If equal, then the function should return the string 'You win!', Otherwise you need to return the string 'Try again!'. def guess_number(guess): number = 42 if guess == num...
af32739412f82b395268bf8a13e89b42184a8bb8
ton4phy/hello-world
/Python/59. Cycles.py
817
4.125
4
# Exercise # Implement the is_arguments_for_substr_correct predicate function, which takes three arguments: # the string # index from which to start extraction # extractable substring length # The function returns False if at least one of the conditions is true: # Negative length of the extracted substring # Negative...
e46ecacef41bd93f32873bc7017c91409ad66be9
ton4phy/hello-world
/Python/44. Function.py
326
3.84375
4
# Exercise # Implement the function get_formatted_birthday, which accepts three parameters for input: day, month, and year of birth, # and returns them as a string in a formatted form, for example: 30-02-1953. def get_formatted_birthday(date, mouth, year): result = '%02d-%02d-%d' % (date, mouth, year) return r...
a26b6cebfc46d5b1a2f96b65e373c47b02463d1b
fgaurat/gsfpython
/gsf/calcul.py
255
3.53125
4
# -*- coding: utf-8 -*- def division(a,b): if b == 12: try: raise Exception("Div by 12") finally: print("erreur interne") return a/b if __name__ == "__main__": result = division(1,2) print(result)
375082e62a0afaeb8a8b94b5dd74a255107e250c
fgaurat/gsfpython
/tpif.py
275
4.0625
4
# -*- coding: utf-8 -*- str_x = input("un nombre :") x = int(str_x) # print x==0?"oui":"non" print("oui" if x==0 else "non") if x < 0: x = 0 print('Negative changed to zero') elif x == 0: print('Zero') elif x == 1: print('Single') else: print('More')
5226c7ab16e47013b7f64f234033016c5950f9ef
sarunm/python_problem
/problem_0009.py
350
3.515625
4
input_data = sorted([int(i) for i in input().split(' ')]) sort_data = str(input()) result_data = [] for item in sort_data: if item == "A": result_data.append(input_data[0]) elif item == "B": result_data.append(input_data[1]) elif item == "C": result_data.append(input_data[2]) print("...
967788a456b5c57b5b5e48a71c2b70fafec26114
patilsakshi123/python.fun
/fibonacci sequence.py
379
4.28125
4
nterms= int(input("how many terms:")) n1,n2= 0,1 count=0 if nterms <=0: print("please enter a positive integer:") elif nterms ==1: print("Fibonacci sequence upto", nterms ,":") else: print("Fibonacci sequence :") while count < nterms : print(n1) nth =n1+n2 n1=n2 ...
ebcb558d7cc31f6c475854d156619b638659a5fb
liuliainio/liuli
/tykj-operation/tykj-operation/core/estorecore/utils/enum.py
1,273
3.515625
4
class Enum(object): ''' An enum type used in django convenience. >>> from enum import Enum >>> e = Enum({"ONE":(1,"One")}) >>> print e.ONE 1 >>> print e.to_choices() ((1, 'One'),) >>> print e.to_dict() {1: 'One'} >>> print e.get_label(1) One >>> print e.get_key(1) ...
453b52928008d65c022cffe4922a052a8edcab3d
rajat6219/python
/Activity_11.py
334
3.90625
4
def input_number(): num1 = int(input('Enter the first number: ')) num2 = int(input('Enter the second number: ')) return num1, num2 def add(a, b): return a+b def display(a, b, c): print(f'{a} + {b} = {c}') def main(): num1, num2 = input_number() answer = add(num1, num2) display(num1, num2, ans...
bd152a5e10c36bfc628bcd88b405966b3741c0c2
Chriskoka/Kokanour_Story
/Tutorials/mathFunctions.py
557
4.28125
4
""" Math Functions """ #Variables a = 3 b = -6 c = 9 #Addition & Subtraction print(a+b) print(a-b) #Multiplication & Division print(a * b) print(a / b) #exponents print(a ** b) # Notice ** means to the power of print(b ** a) #Square Root & Cube Root print(c ** (1/3)) print(c ** (1/2)) #Modulus (% symbol is us...
20ffa4780a571b56cd17304dde237f4a4fb7eed5
Chriskoka/Kokanour_Story
/Tutorials/addSix.py
233
4.3125
4
""" This program will take the input of the user and return that number plus 6 in a print statement """ numb = int(input ('Choose an integer from 1 to 10. Input: ')) print ('The number ' + str(numb) + ' plus six = ' + str(numb + 6))
55dc5071247d1098b1d5b2413391fb032b6a9aea
looksticknow/projectEuler
/projectEuler/problem001/multiples35.py
205
3.796875
4
sumList = [] for i in range(1,1000): if i % 3 == 0 or i % 5 == 0: sumList.append(i) print(sumList) sum = 0 for i in range(0,len(sumList)): sum += sumList[i] print(sum)
f70203c88cd1913445b89c7423584d93a9653f54
looksticknow/projectEuler
/projectEuler/problem011/triangularNumber_Test.py
1,299
3.515625
4
done = False triNum_Start = 0 triNum_Stop = 1000 stepSize = int(triNum_Stop/10) triNum_Stop += 1 while not done: triNum_List = [] divisor_List = [] for i in range(0,int((triNum_Stop-1)/stepSize)): divisor_List.append([]) # Making the list of the triangular numbers up to n ...
a1fc083f845d545874fdf3f31b5f7be08a92d33c
daniel2483/NextUExercises
/FundamentosDeProgramacionPython/Modulo3-EstructurasDeControl/Ejercicio 5 - Condicionales Py/ejercicio_5.py
543
3.6875
4
saldoActual = 45 saldoAnterior = saldoActual moneda = "US$" moneda = input("Con cual moneda desea realizar el pago (BTC,DASH o LTC): ") cantidad = float(input("Ingresa una cantidad: ")) cotizacionBTC = 0.55 cotizacionDASH = 0.34 cotizacionLTC = 0.23 if moneda.lower() == "btc": saldoActual+= cotizacionBTC * ca...
f1284e3139c77215e20d102bbd74bf610f4582c1
yaumianwar/Task3
/suit.py
863
3.515625
4
def suit(data): win = "" for a in data: if a['player1'] == a['player2']: win = "Permainan Seri" if a['player1'] == "gunting": if a['player2'] == "batu": win = a['player2'] if a['player2'] == "kertas": win = a['player1'] ...
d20a5924f69b35465cab58fa474a72975e141fa3
19adilson7/ExercicioRevisaoPython
/Questão7.py
274
3.921875
4
vetor = [] print ('Digite 10 numeros') for i in range(10): vetor.append(input('Numero '+ str(i+1) + ':\n' )) vetor2 = [] print ('Digite 10 numeros') for i in range(10): vetor2.append(input('Numero '+ str(i+1) + ':\n' )) vetor3 = vetor+vetor2 print(vetor3)
4c052d697d107abdf5070a069efe104a7d0369a6
yuvan03/sequence-processors
/file_parser.py
602
3.546875
4
import sys import os class FileParser(): def __init__(self, filelocation): self.filelocation = filelocation input_data = self.read_file() print("File contents: {}".format(input_data)) def read_file(self): file_contents = "" with open(self.filelocation, "r") as f: file_...
0838e7bca4295999e847c41b218bd1b5b928e6c1
josandotavalo/OSSU
/001-Python-for-Everyone/Exercise-9.5.py
814
4.15625
4
# Exercise 5: Write a program to read through the mail box data and when you find line that starts # with “From”, you will split the line into words using the split function. We are interested in who # sent the message, which is the second word on the From line. # You will parse the From line and print out the second...
1eabbfb92d4800147b487cb0659b12883ab6ccd5
josandotavalo/OSSU
/001-Python-for-Everyone/Exercise-12.2.py
532
4
4
# Exercise 2: Write a program to look for lines of the form: # New Revision: 39772 # Extract the number from each of the lines using a regular expression and the findall() # method. Compute the average of the numbers and print out the average as an integer. import re file_name = "mbox-short.txt" file_hand = open(fil...
4135921912b34bcc4a05ada74730ab6377a25197
josandotavalo/OSSU
/001-Python-for-Everyone/Exercise-4.2.py
476
4
4
# Exercise 2: Rewrite your pay program using try and except so that your program handles # non-numeric input gracefully by printing a message and exiting the program. # The following shows two executions of the program: hrs = input("Enter Hours: ") rate = input("Enter Rate: ") try : h = float(hrs) r = float(...
0d7143afe2ba8d765e27f570ddc6e9eddd117903
TablesawTablesawsen/advent-of-code-2018
/stars/10b.py
1,216
3.546875
4
class Star(object): """docstring for Star""" def __init__(self, txt): self.x, self.y, self.vel_x, self.vel_y = tuple(int(x) for x in txt.split()) def forward(self): self.x = self.x + self.vel_x self.y = self.y + self.vel_y def back(self): self.x = self.x - self.vel_x ...
3051bc4b396dc9c55025a04b20b385e72d229a43
apettenati/jetbrains-python
/Loan Calculator/Loan Calculator/task/creditcalc/creditcalc.py
8,477
4.03125
4
import math import argparse # Phase 1 final_output = 'The loan has been repaid!' first_month = 'Month 1: repaid 250' second_month = 'Month 2: repaid 250' third_month = 'Month 3: repaid 500' loan_principal = 0 print(loan_principal, first_month, second_month, third_month, final_output, sep='\n') # Phase 2 loan_principa...
8206ecef3b76c613cb7c2385529855b3c1b00a96
geeeyeon/Python
/tk06.py
232
3.6875
4
from tkinter import * from tkinter import messagebox window=Tk() btnList=[None]*3 for i in range(0,3): btnList[i]=Button(window, text='버튼'+str(i+1)) for i in range(0,3): btnList[i].pack(side=RIGHT) window.mainloop()
ad61aec96fc665a6cfb97ea09a633886be797931
GoogleGu/leetcode
/leetcode/dynamic programming/leet_1218.py
672
3.5625
4
class Solution: def longestSubsequence(self, arr, difference): """ 核心思想: dp[i]定义为之前的序列中,数字i对应的最长等差子序列的长度 状态转移方程为 dp[j] = max(1, dp[i - difference] + 1) 因为j数字对应的最长等差子序列长度要么就是在之前的这个j-difference数字上加1,要么就是从头算起也就是1。 """ dp = dict() for num in arr: ...
1088a2ccc5d8acea2f4ec3225e0de09c4034efa2
GoogleGu/leetcode
/leetcode/dynamic programming/leet_120.py
587
3.578125
4
class Solution: """ 直接使用维特比算法 """ def minimumTotal(self, triangle): for row in range(1, len(triangle)): triangle[row][0] += triangle[row-1][0] for col in range(1, len(triangle[row])-1): triangle[row][col] += min(triangle[row-1][col], triangle[row-1][col-...
0aecce783f4eaf4d50d7df629b2a54bbd8dfd84d
AnsumanMishra-git/Cats-Vs-Dogs
/CatVSDog.py
3,782
3.5
4
# Part 1 - Building the CNN # Importing the Keras libraries and packages from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense from keras.layers import BatchNormalization from keras.layers import Dropout...
ab4f12fae20e5c48769218b13cf4697beb49a302
AlpineMeadow/M567-Class-Project
/ClassReadData.py
1,251
3.734375
4
#! /usr/bin/env python3 def main() : import ClassReadDataFunctions as CRDF #The name of the stock we are looking at. StockAbbrev = 'nflx' #The date and time for the data. These will have to match up with the #data file you want to look at. year = 2020 month = 2 day = 26 hour = 7 ...
dd6d7249d5c410bf60463cb90f6179380dc71493
KieferVermeulen/Casimir-programming
/test.py
126
3.859375
4
import math as mt print('hello world') def circumference(radius): circumference = 2*mt.pi*radius return circumference
c001a61406ddc9402d953cd2545418cc8622862d
laynecsmall/looping_theremin
/arduino/sensor_tuning.py
2,716
3.75
4
import serial import math import matplotlib.pyplot as plt import numpy as np # requires pyserial class sensor: """ Sensor, represents a collection of values from a sensor. Used to calculate a running average and std deviation for measuring sensors """ count = 0.00001 total = 0.000...