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
828de54318128d241e045cd65fb720ba1484ca75
pandey-ankur-au17/Python
/coding-challenges/week11/day02/ccQ3.py
508
3.890625
4
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def middleNode(head): slow = head.next fast = head.next if not head or head.next is None: return head while slow is not None and fast.next is not None and fast.next.next is not N...
8a5fab7c842b58907fc8228a65a816c236932ca1
Milkytrace/c_to_f
/c_to_f.py
321
3.9375
4
print('這是一個可以把攝氏溫度轉換為華氏的程式\n') print('如需退出,請輸入 q') while True: celcius = input('請輸入攝氏溫度: ') if celcius == 'q': break else: celcius = float(celcius) F = celcius * 9 / 5 + 32 print('華氏溫度是:',F) print('謝謝你使用這個程式')
632564d4d1d0ed5f9c4cc1a8d9a36b67ab263810
alishalabi/binary-search-tree
/binary_search_tree.py
2,888
4.25
4
""" Step 1: Build a binary search tree, with add, remove and in methods. Step 2: Perform DFS's and BFS """ class BinaryTreeNode: def __init__(self, data, left_child=None, right_child=None): self.data = data self.left_child = left_child self.right_child = right_child self.is_leaf =...
413fb368a2e44f56ba8b59ba4e5e767cedf254eb
Neojunho/pythonstatistic
/lecture02_PythonBasicGrammar/variable.py
1,086
3.796875
4
# 변수의 선언과 할당 # a = 1 # b = 1.1 #변수를 선언하고 변수에 들어 있는 데이터 확인하는 방법 # print(a + b) # 다양한 형태로 선언과 할당 # c, d = 1, 1.1 # print(c + d) # x, y = 12, 30 # print(x, y) # x = y # print(x, y) # x, y = 12, 30 # x, y = y, x # print(x, y) # 영어, 숫자로 구성(한글도 가능) # a123 = 1 # 한글가능 = 2 # print(a123 + 한글가능) # 띄어쓰기 금지. 언더바(_)로 표시 #한글 가능 ...
3180dd70b83df30b8c3d109a8c6f383a51926656
NextLmabda/classMaterials
/Projects/PROJECT1 Car Price Prediction/datacleaning.py
383
3.59375
4
def LabelEncoder(x): if x == 'convertible': return 1 elif x == 'hatchback': return 2 elif x == 'sedan': return 3 elif x == 'wagon': return 4 else: return 5 def square(x): return x ** 2 print(square(100)) import pandas as pd data = pd.read_csv('dataset...
f8c78f310b51c3af0ff82744fa7ac9a9118ce165
Hinal-Sonkusre/Python-Internship
/day4python.py
2,561
4.1875
4
# function # def myfunction(): # print("Hello world") # # # myfunction() # # # def myfunction1(name): # print("Name is:", name) # # # myfunction1("Hinal") # def myfunction2(name): # return name # # # name = myfunction2("Hinal") # print("Value is ", name) # def myfunction(): # ...
ca27fe93cdb8a746bd480cd45b8b6a9f930eced9
brunohprada/Python-para-zumbis
/lista-4/01_sorteio.py
420
3.71875
4
''' Sorteie 10 inteiros entre 1 e 100 para uma lista e descubra o maior e o menor valor, sem usar as funções max e min. Autor: Felipe Nogueira de Souza ''' import random lista = [] maior = 1 menor = 100 for i in range(10): lista.append(random.randint(1, 100)) if lista[i] > maior: maior = lista[i] if...
2871bbaccc81e158cd4f7ae714af0a1c53ef2fce
brunohprada/Python-para-zumbis
/lista-2/01_triangulo.py
903
4.25
4
''' Lista 2 - Exercicio 1. Faça um Programa que peça os três lados de um triângulo. O programa deverá informar se os valores podem ser um triângulo. Indique, caso os lados formem um triângulo, se o mesmo é: equilátero, isósceles ou escaleno. ''' lado1 = float(input('Informe o valor do primeiro lado: ')) lado2 = float...
f3fd05cd8a7ac17a0809891fd7fb7fcb338c6972
brunohprada/Python-para-zumbis
/lista-1/09_aluguel.py
539
4.125
4
''' Lista 1 - Exercício 9 Escreva um programa que pergunte a quantidade de km percorridos por um carro alugado pelo usuário, assim como a quantidade de dias pelos quais o carro foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$ 60,00 por dia e R$ 0,15 por km rodado. Felipe Nogueira de Souza @_outrofelip...
94d93fd3efb551b816ffc785860b74e727875c20
brunohprada/Python-para-zumbis
/exercicios-e-exemplos/acessarDB.py
310
3.609375
4
import sqlite3 con = sqlite3.connect('alunos.bd') cur = con.cursor() cur.execute('''insert into alunos values("masanori", 42)''') cur.execute('''insert into alunos values("emengarda", 66)''') cur.execute('''select * from alunos''') for x in cur.fetchall(): print(x) cur.close() con.commit() con.close()
c487834917c5dea6e90d0aea3a7b0f913c3b1509
brunohprada/Python-para-zumbis
/lista-4/05_contaPython.py
1,751
3.875
4
''' Seja o statement sobre diversidade: “The Python Software Foundation and the global Python community welcome and encourage participation by everyone. Our community is based on mutual respect, tolerance, and encouragement, and we are working to help each other live up to these principles. We want our community to be ...
46f3e20e807f3d3690789b18a6b4932a72185170
brunohprada/Python-para-zumbis
/exercicios-e-exemplos/dicionario.py
499
4.0625
4
d = {} d['a'] = 'alpha' d['o'] = 'omega' d['g'] = 'gama' print(d) print(d['a']) print(d['o']) print(d['g']) #posso pegar as keys print(d.keys()) #ou os valores print(d.values()) letra = input('Informe uma letra: ') #pergunto se está no dict if letra in d: print('%s está no dicionario' %letra) else: print('%...
e30664a0cffb97574b995cefd0cfaa710790307b
brunohprada/Python-para-zumbis
/exercicios-e-exemplos/baixoNivel.py
209
3.734375
4
import dis print('Assembly de uma soma:') dis.dis('c = a + b') def f(n): k = 1 f = 1 while k <= n: f *= k k += 1 return f print('\nAssembly da função fatorial:') dis.dis(f)
3b999bdba61345922dbe55e7bc650b5e5835c964
brunohprada/Python-para-zumbis
/lista-2/05_menor.py
631
4.0625
4
''' Lista 2 - Exercicio 5. Faça um Programa que leia três números e mostre o menor deles. ''' num1 = int(input('Informe o primeiro numero: ')) num2 = int(input('Informe o segundo numero: ')) num3 = int(input('Informe o terceiro numero: ')) if num1 <= num2 and num1 <= num3: if num2 <= num3: maior = num3 ...
e9aacf02ef3849c6eecaad26e8f7d964a8b17275
DominikKossinski/PED
/split.py
692
3.71875
4
import pandas as pd def split_csv(file_name): df = pd.read_csv(file_name, index_col=0) print(df) n = len(df) h = n // 2 t = n - h head = df.head(h) tail = df.tail(t) head.to_csv(file_name.replace(".csv", "_head.csv")) tail.to_csv(file_name.replace(".csv", "_tail.csv")) print(f"...
4c65b086977b329f8d95ec450fcf6e9f68e9f40d
pancakewaffles/Stuff-I-learnt
/Intro to Machine Learning/svm/svm_author_id.py
1,581
3.546875
4
#!/usr/bin/python """ This is the code to accompany the Lesson 2 (SVM) mini-project. Use a SVM to identify emails from the Enron corpus by their authors: Sara has label 0 Chris has label 1 """ import sys from time import time sys.path.append("../tools/") from email_preprocess import preproce...
0bb123d4261f05d1c3b1654c10cff9300a408135
pancakewaffles/Stuff-I-learnt
/Python Refresher/Python for Security Developers/Module 2 Apprentice Python/Activities/Apprentice_Final_Activity.py
1,475
4.125
4
import operator saved_string = '' def remove_letter(): #Remove a selected letter from a string base_string = str(raw_input("Enter String: ")); letter = str(raw_input("Letter to remove: ")); i = len(base_string) -1 ; while(i < len(base_string) and i >= 0): if(base_string[i] == le...
5413ee63cdc431e23a69ac2b6347a6e8cc1d58a2
pancakewaffles/Stuff-I-learnt
/Python Refresher/Python Math/5 Sets, Probability, Cartesian Products, Law of Large Numbers, Estimating Area of a Circle/estimateAreaofCircleAndAlsoPi.py
1,671
3.984375
4
#! estimateAreaofCircleAndAlsoPi.py # Are you familiar with the dartboard estimation of the area of a circle? ''' Consider a dartboard with a circle of radius r inscribed in a square with side 2r. Now let's say you start throwing a alrge number of darts at it. Some of these will hit the board within the circle (e.g. N)...
cb48aff62616fd3fe4888d6a4fde3aef185d99c1
pancakewaffles/Stuff-I-learnt
/Python Refresher/Python Math/1 Numbers, Fractions, Complex, Factors, Roots, Unit Conversion/quadraticRootsCalc.py
517
4.15625
4
#! quadraticRootCalc.py # Finds roots of quadratic equations, including even complex roots! def roots(a,b,c): # a,b,c are the coefficients D = (b*b - 4*a*c)**0.5; x_1 = (-b+D)/(2*a); x_2 = (-b-D)/(2*a); print("x1: {0}".format(x_1)); print("x2: {0}".format(x_2)); #print("x1: %f"%(x_1)); Doesn'...
38f8b6498b4d756f7f2255109323fa4112f48e8f
pancakewaffles/Stuff-I-learnt
/Python Refresher/Python Basics/collatz.py
280
4.1875
4
#Collatz Conjecture def collatz(number): if(number%2==0): print(number//2); return number//2; else: print(3*number + 1); return 3*number + 1; print("Enter number:"); number = int(input()); while(number > 1): number = collatz(number);
f1e8fe80c20eb071492a2627f934d8f4656d9e36
Surja-Sanyal/Fun-With-Python3
/Soft Computing/Artificial Neural Networks/The Perceptron/The Positive Number Recognizer - Single Input Perceptron/1_Positive_Number_Recognition.py
2,103
3.546875
4
#Trying to train the computer to recognize positive numbers: The single Perceptron with single input import sys import random def generateData(): inputFile=open((sys.argv[0]).split(".")[0] + "_TrainingData.txt", "w") for i in range(10000): nextInt=random.randint(0, 10000) multipli...
4e8a52d1b2563727ac655e2c84ad0b80af626e29
fpert041/experiments_in_ML_17
/LB_02_TestEx.py
1,274
4.21875
4
#PRESS <Ctrl>+<Enter> to execute this cell #%matplotlib inline #In this cell, we load the iris/flower dataset we talked about in class from sklearn import datasets import matplotlib.pyplot as plt iris = datasets.load_iris() # view a description of the dataset print(iris.DESCR) %matplotlib inline #above: directive ...
4b276fe8c31de58c03fecfb1dccfdd3d1fe5d39c
alberto-martinbelloso/IoT_WaterFlow_UserService
/api/bills/models.py
661
3.5625
4
class Bill(object): def __init__(self, user, from_date, to_date): self.user_id = user.id self.username = user.username self.from_date = from_date self.to_date = to_date self.devices = user.devices self.measurements = dict() self.waterflow = 0 self.pric...
f1f6229da44d3b116e44a50c3ee96fdec9c454de
Gnanender-reddy/FundooApp
/models/db_operations.py
6,434
3.890625
4
""" @Author : P.Gnanender Reddy @Since : Dec'2019 @Description:This code is for managing database. """ from config.mysql_connection import database import re mydbobj=database class Models: """ This class is used to form connection with the database and perform operation update, add and check entry into th...
24fa4f0b15909a4e2f330d1e9f7cfc3e1c934865
debankit/p342assignements
/assg2/q2.py
378
3.84375
4
#to define two matrices and find their sum and dot product a = [2, 5, 7] b = [6, 6, 8] sum = [] dot = 0 for x in range(3): sum.append( a[x]+b[x] ) for x in range(3): dot= dot+ (a[x]*b[x] ) print("Sum of the matrices") for x in sum: print(x) print("Dot prodduct of the Matrices") print(dot) #Output #Sum of ...
8a805e6e2092c0e0ed6eab6a31fc630e503f529a
debankit/p342assignements
/assg1q1.py
96
3.734375
4
# Program to sum over 1 to 100 n=1 s=0 while(n<101): s= s+n n+=1 print("The sum is" ,s)
daaa4dc90f721d26333006a29991ccc700fbab82
fcrdossantos/201501262203
/tic_tac_toe.py
8,565
3.875
4
import getopt import sys import time import random def print_board(board): board = ''.join(board) if len(board) == 9: print(" ") for line in range(3): line_str = '' line_bar = ['','|','|'] for item in board[line*3: line*3+3]: if ite...
358662760390b7c8e10aee9f4a2dfa7b38ed5733
rainage1/Budget-Bunny
/main.py
8,391
3.5625
4
from datetime import datetime from depositMoney import chequingDeposit, savingDeposit from transferMoney import chequingToSaving, savingToChequing from financialTips import randomTip import menu def findRow(username): row = -1 for i in range(len(fields)): if str(username) == fields[i][0]: row = i retu...
7f30d4e1312559c75105f1f4d5ec13903e720b6b
brechann-mcgoey/Modern_romance
/src/new_romances.py
2,032
3.671875
4
from scrape_new import * import pandas as pd import pickle from bs4 import BeautifulSoup #this can be replaced with whatever starting point is desired. #In case below, the first pages of Best_Book_Boyfriends had already been scraped list_address="https://www.goodreads.com/list/show/10762.Best_Book_Boyfriends?page=40" ...
51566d3b7594dcf9696db42f968a1d76d88dce88
alexgorelik123456/PT2-02-16-P1
/PT2-02-16-P3.py
237
4.0625
4
def to_weird(my_string): str1 = my_string.lower() str2 = '' for num, c in enumerate(str1): if num % 2 == 0: str2 += c.upper() else: str2 += c print(str2) to_weird('DON\'T PANIC!')
8054030b10d01a4f7d088c6ad47bdbf854b40160
sashanesterenko/Week-2-Problem-Set
/get_sum.py
194
3.6875
4
def get_sum(num_one, num_two): try: sum = int(num_one) + int(num_two) print(sum) except ValueError: return print("Type a number, will you?") get_sum("fsdf", 5)
966ff17a2ceac7ad53d2993a6422cb5c287cc66c
rodlewis360/Primefinder
/Primefinder2.py
896
3.96875
4
def findprime(): times = 0 timeswrong = 0 from time import sleep import math Prime = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199] for i in Prime:...
8f69c68e458e15e1412047a41005f9582da198e5
emmanuelr20/Mine
/Newton-Raphson.py
2,213
4.03125
4
def isReal(num): """checks if num is a valid number either float or int""" try: float(num) return True except: return False def getCoeff(): """get the coefficient of a polynomial and return it as a list""" coeff=[] valid=False while valid == False: num_of_element...
395163acfab1e3a9dfe3f5c22d70327f18610f1e
emmanuelr20/Mine
/guessingGame.py
711
4.03125
4
from random import random from math import floor ask=1 while ask != 0: print("I am looking for a number between 0 and 9??") answer=random()*100//10 numOfTries=3 while numOfTries >0: guess=int(input("Enter guess: ")) if guess==answer: print("You guessed correctly!!!\nAnswer ={...
0e9ffbb5a44a0fe26c777e5e6bde99695e791e40
veitham/DataVisualizationProject
/mymaps.py
5,476
3.609375
4
import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from math import ceil import pydeck as pdk def count_rows(rows): return len(rows) def getDate(month_and_year): months = ['january','february','march','april','may','june','july','au...
1dfbac10e6fb4c2d491c1f488fe1436164673d47
katvik001/Automation-Scripts
/NmapScanner.py
1,762
3.671875
4
import os import time TargetIP = input("Enter the IP of Target Machine :") print("Enter the number to perform the tasks :\n") print(""" Press 1 for Basic Scanning Press 2 for Scanning Specific Port No Press 3 for Scanning IP Ranges Press 4 for Scanning top-popular ports Press 5 for Scanning with disbaling D...
a9dc1bcc83dcf69e5fc8f2cd2413cd215ecd3f81
kamocyc/arithmetic-code
/arith_float.py
2,006
3.625
4
from typing import List, Dict # 浮動小数点を使うバージョン # 文字列長が長くなると、誤差で動かない # 現在使っていない model = {"a": 0.625, "b": 0.4} text = "ababaaa" interval = [0.0, 1.0] for c in text: # a側 -> 下 if c == 'a': interval[1] = (interval[1] - interval[0]) * 0.625 + interval[0] else: interval[0] = (interval[1] - int...
c62f422c6a55f3d10b596436007bd926a841e8ce
rahultworoads/design_pattern
/SA/delivery_executive.py
1,038
3.546875
4
from datetime import datetime class DeliveryExecutive: """ Represent the executive """ def __init__(self, id, current_location, last_order_delivered_time, status): self.id = id self.current_location = current_location self.last_order_delivered = last_order_delivered_time ...
7850ea91ec63bb05fdd5b55bc83c9040e637f51a
ianjosephjones/Python-Pc-Professor
/8_25_21_Python_Class/keep_trak_of_results.py
683
3.578125
4
from random import randint LOSS = 0 WIN = 1 def dummy_craps(): lose_or_win = randint(0, 1) number_of_rolls = randint(1, 10) print(f"Craps! You {lose_or_win} in {number_of_rolls} rolls") if lose_or_win == LOSS: results[number_of_rolls][LOSS] += 1 else: results[number_of_rolls][WIN...
1adb144238abf3ad518e644c680a44e7b66cca15
ianjosephjones/Python-Pc-Professor
/8_11_21_Python_Classs/Exercise_5-11.py
723
4.5625
5
""" 5-11: Ordinal Numbers --------------------- Ordinal numbers indicate their position in a list, such as 1st or 2nd. Most ordinal numbers end in th, except 1, 2, and 3. Store the numbers 1 through 9 in a list. Loop through the list. Use an if-elif-else chain inside the loop to print the proper ordinal ending for each...
5923a13cb030f647735736e65bc8e08e1ecc5544
X-H-W/xhw
/所有.py/练习/lol.py
2,735
3.9375
4
''' 游戏:英雄联盟 新手指导: 1、注册帐号 2、登录帐号 3、选择服务器 4、创建名称 人物职业 ''' lolo = '新手指导' print(lolo.center(40)) print('*'*40) print('*'*40) print('第一步:%s\n第二步:%s\n第三步:%s\n'%('注册','登录','选择服务器')) print('*'*40) lol = [{'name':'123','passwd':'321'}] while True: print('*'*40) print('1、登录','2、注册','4、进入''3、退出') register_login = int(...
fb2d341b41470ee8f365bd0634fefa8443149e33
X-H-W/xhw
/所有.py/函数/长度参数.py
169
3.53125
4
def demo(*p): print(p) demo(1,2,3) print('*'*30) demo(1,2,3,4,5,6,7) print('*'*30) def demo2(**p): for item in p.items(): print(item) demo2(x=1,y=2,z=3)
c2523fe5823aa2ad3b9b3c217a0a4502cbe6d82e
X-H-W/xhw
/所有.py/书.py/王者荣耀2.py
1,302
3.6875
4
heroes = ['安其拉','李白','潘僧','貂蝉','孙悟空'] for hero in heroes: if hero == '李白': print('您选的英雄超级厉害!') else: print('您选的英雄一般般厉害') hero = 'libai' if hero == 'libai': print('您选择的英雄是超级大嘴跑:李白!') if hero == 'LIBAI': print('您选择的英雄是名字大写的超级嘴炮:李白!') hero1 = '老夫子' if hero1 != '后裔' print('恭喜,这句对战已经赢了一半!') age = 11 if age <= 1...
996fe11feacf7fae267924380869bdf74f01aba0
X-H-W/xhw
/所有.py/作业/烤地瓜三.py
349
3.5
4
class people: def __init__(self,eyes,head = '黑色'): self.eyes = '红色' self.head = '黑色' def run(self): print('%s'%self.eys) def printpeople(self): print(self.eyes) print(self.head) xiaoming = people('我') xiaoming.printpeople() print('%s'%xiaoming.eyes) #print('%s是%s'%xi...
39df64626ca45f7652ad74d2632a95f0363904a0
empgaurav/Hacker_rank-solutions
/extralongfactorials.py
332
3.625
4
#!/bin/python3 import math import os import random import re import sys # Complete the extraLongFactorials function below. def extraLongFactorials(n): m = 1 if(n == 0): print(1) for i in range(1,n+1): m = m * i print(m) if __name__ == '__main__': n = int(input()) extraLongFa...
251bb32b91b45d0f95fa1f0d088bd5c6effb2cdf
prkfoxxx/learn_python
/insert.py
269
3.6875
4
a = [ ] x = input("Enter he total number of elements to be sorted") for j in range (x) : a.append(input("enter the element")) for j in range (1,len(a)) : i=j-1 k=a[j] while i>=0 and a[i]>k : a[i+1] = a[i] i=i-1 a[i+1]=k print a
27983c9388a636fc1c1073b46fd8693359d5fba8
tagore15/MACHINE_LEARNING_NANODEGREE_UDACITY
/P4_REINFORCEMENT_LEARNING/smartcab/agent.py
4,988
3.625
4
import random from environment import Agent, Environment from planner import RoutePlanner from simulator import Simulator class LearningAgent(Agent): """An agent that learns to drive in the smartcab world.""" def __init__(self, env): super(LearningAgent, self).__init__(env) # sets self.env = env, sta...
370a57d0304012b75d9a483448dca67d57b4103a
equaglia/Exercicios-Curso-Python-CISCO
/Module5Pyt.py
4,181
4.1875
4
print("Hisssssss...") ''' import math for name in dir(math): print(name, end="\t") ''' #----------------------- ''' from platform import platform, machine, processor, system, version, python_implementation, python_version_tuple print(platform()) print(platform(1)) print(platform(0,1)) print(machine()) print(p...
051b637eda8be651d49da60a5dc8e78af7f16a18
Frankenstien-hack/Machine_Learning
/OpenCV/face_recog.py
3,094
3.5625
4
# Recognising face using some algorithm like Logistic Regression, KNN, SVM etc. # Step 1. Load the training data (numpy arrays of all the person) # x-values are stored in the numpy arrays # y-values we need to assign fo reach person # Step 2. Read a video stream using opencv # Step 3. Extr...
3d50bb0e103719add0b6bd76127a557dc7fac998
alexander-koronovskiy/company
/algorithms/fibonacchi.py
170
3.5
4
def fib_simple(n: int): a, b = 0, 1 for _ in range(n): b, a = a + b, b return a fib_rec = lambda n: fib_rec(n - 1) + fib_rec(n - 2) if n > 2 else 1
1cf82fcb5d202ebc80adc0992c794f6533f67d53
Mooshoopork/Uh
/questioneer.py
947
3.828125
4
import sys print("This is a questioneer about the programer.") print("Please awnser with numeric values.") print(" ") num = input("What is my favorit number? ") print(" ") if float(num) == 5: print("Correct") print(" ") year = input("What year is it? ") print(" ") age = input("How old am I? ") p...
2d39808d649e96b1314457bf8a14b43e2c25bbe9
Mooshoopork/Uh
/name.py
344
3.53125
4
names = ['Sam', 'Gianna', 'Emily', 'Jacob', 'Holden', 'Maverick', 'Nicky', 'Ian', 'Ryan'] print("These are my friends:") print(names[0]) print(names[2]) print(names[3]) print(names[5]) print(names[6]) print(names[7]) print(names[8]) print("I dont really know this person:") print(names[4]) print("I CAN NOT STAND THIS PE...
e48a8a7fb393f15dc966ec8c063b6f788e96eab4
Mooshoopork/Uh
/arrayreverse.py
507
3.953125
4
from array import * anum = array('i', [1, 3, 5, 3, 7, 1, 9, 3]) print("In normal order: " + str(anum)) anum.reverse() print("In reverse order: " + str(anum)) print() print("The better version.") anum.reverse() print('In normal order: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}'.format(anum[0], anum[1], anum[2], anum[3], anu...
0397c118fdfb879da0142e62cfcc96d846fee2d6
Mooshoopork/Uh
/arrayonmyown.py
257
4.09375
4
#how to create an array from array import * array_num = array('i', [1,2,3,4,5,6,7,8,9,10]) #How to print it for i in array_num: print(i) #Next part print("Access first three items individualy") print(array_num[0]) print(array_num[4]) print(array_num[9])
ba5de346fd5df488fd0acc3cc52d9e6fa200c7cd
Mooshoopork/Uh
/predictayear.py
222
3.96875
4
print("This will predict what year it will be when you are a certain age.") start = input("When were you born? ") age = input("What age do you want to predict? ") end = int(start) + int(age) print("The year will be:", end)
2a22b1d2e4eb372859087569c890305222b73195
Mooshoopork/Uh
/sortvowels.py
87
3.828125
4
#vowel list vowels = ['e', 'a', 'o', 'u', 'i'] #sort vowels.sort() #print print(vowels)
b4570cbc661783a7d217cd3de1f0cc26adb67203
Mooshoopork/Uh
/passcodechecker.py
801
3.90625
4
#Passcode import re p = input("Input your passcode here: ") x = True while x: if (len(p)<6 or len(p)>20): l = " the length is between 6 and 20 characters." break elif not re.search("[a-z]",p): l = " there is a lowercase letter charecter." break elif not re.search("[0-9]",p):...
cd7df41cd3b77c163d2ce1eda9dc4500e1b038c9
Mooshoopork/Uh
/multiplcationtable1-10.py
777
4.25
4
#Mutiplication table from 1-10 while True: num = input("What number would you like to multiply? ") try: num = int(num) break except: print("Please input an integer.") print("Here is the multiplication table:") awn = num * 1 print(str(num) + " x 1 = " + str(awn)) awn = num * 2 print(s...
2b469dc2001b109a52a315381342cb6251db8d4f
Mooshoopork/Uh
/listcars.py
121
3.84375
4
# we are making a names list program. cars = ['Honda', 'Ferrari', 'Chevy', 'Kia', 'Jaguar'] print(cars[1]) print(cars[3])
94d024f693b1314e710c5fda80bbfcbb88205f69
awesomeleoding1995/Python_Learning_Process
/python_crash_course/chapter-1&2/simple_message.py
147
3.890625
4
#2-1 store a message in a variable, and then print that message message = "This is Lee, waiting for the coming exam in tomorrow." print (message)
15a517a5443e03e322d9c2fbfcdbb31c9418cf25
awesomeleoding1995/Python_Learning_Process
/python_crash_course/chapter-9/user.py
1,773
4.125
4
class User(): """this class is used to create user-related profile""" def __init__(self, first_name, last_name): self.f_name = first_name self.l_name = last_name self.login_attempts = 0 def describe_user(self): formatted_name = self.f_name + " " + self.l_name return formatted_name.title() def greet_use...
196575e90b9a6e50edc9c3de970f739f2de24f5d
awesomeleoding1995/Python_Learning_Process
/python_crash_course/chapter-1&2/famous_quote.py
484
3.828125
4
# Find a quote from a famous person you admire. # Print the quote and the name of its author. # Your output should look something like the following, including the quotation marks: # Albert Einstein once said, "A person who never made a # mistake never tried anything new." famous_person = '\tunknown profeeso...
888dcf744b3413de9a95855e84d25032f26f73de
awesomeleoding1995/Python_Learning_Process
/python_crash_course/chapter-11/test_employee_info.py
642
3.78125
4
import unittest from employee_info import Employee class TestEmployee(unittest.TestCase): """a test case aims at Employee class""" def setUp(self): """set up testing example""" self.my_employee = Employee('eggy', 'zhang', 10000) self.employee_info = ['eggy', 'zhang', 10000] def test_give_default_raise(self)...
a7e765ecd2a2408ad28158fd300def472e4723c1
lpc7185657/PythonBook
/PY/0223.py
380
3.890625
4
name = ['jay','skrillex','avicii','zedd','tobu','lpc','rbb','diplo'] #3.3 print(name) print(name[-1]) print(sorted(name,reverse=True,)) print(name[-1]) name.reverse() print(name) #4 for a in name: print(a + ',你真厉害!') #4.2.5 for num in range(1,13): print(num) b = list(range(2,20,2)) print(b) c = [] for numbe...
5d06488fed9f4591ac262e8b8e3e4be337321129
lpc7185657/PythonBook
/PY/0229test1.py
495
3.640625
4
#5-3 5-4 5-5 #color = input('输入颜色:') #if color == 'green': # a = 5 #elif color == 'yellow': # a = 10 #else: # a = 15 #print('获得了' + str(a) + '点!') # 5-6 age = int(input('请输入你的年龄:')) if age < 2: print('他是婴儿。') elif age < 4: print('他正在蹒跚学步。') elif age < 13: print('他是儿童。') elif age < 20: print('他...
69307aefa2549f2b4419494ee73fc4149f22e561
lpc7185657/PythonBook
/PY/0308test.py
717
3.8125
4
#7-4 a = '请输入要添加的食材,有“芝士”、“胡椒”、“牛肉”可选。输入quit退出。' while True: b = input(a) if b == '芝士': print('我们将添加:' + b + '。') elif b == '胡椒': print('我们将添加:' + b + '。') elif b == '牛肉': print('我们将添加:' + b + '。') elif b == 'quit': print('程序已退出。') break elif b != '牛肉' or ...
54c7bf477fefb8c5ca57b762c256c1bce2abeba4
lpc7185657/PythonBook
/PY/0409.py
1,442
3.921875
4
import json # filename = [1,2,3,4,5] # a = 'numbers.json' # with open(a,'w') as b: # json.dump(filename,b) # with open(a) as f_obj: # numbers = json.load(f_obj) # print(numbers) # username = input('What is your name?') #filename = 'username.json' # with open(filename,'w') as f_obj: # json.dump(username,...
0044802fbd06931ce8d734c5d0aa6593867a0432
lpc7185657/PythonBook
/PY/0229.py
256
3.75
4
age = 18 if age >= 18: print('大于18') else: print('小于等于18') a = int(input('请输入你的年龄:')) if a < 4: b = 0 elif a >= 4 and a < 18: b = 5 elif a > 65: b = 5 else: b = 10 print('收费' + str(b) +'元。')
21a79743f4256a06e1e796043a0ff98cd6812a01
lpc7185657/PythonBook
/PY/pizza/pizza.py
167
3.71875
4
def make_pizza2(size,*toppings): print('\nMaking a pizza wish the following toppings:') print('-- ' + str(size)) for a in toppings: print('- ' + a)
27dc85dad52a603c8df7ca93ef2f35da27ed262d
danielvillanoh/conditionals
/secondary.py
2,425
4.59375
5
# author: Daniel Villano-Herrera # date: 7/23/2021 # --------------- # Section 2 # --------------- # # ---------- # Part 1 # ---------- # print('----- Section 2 -----'.center(25)) print('--- Part 1 ---'.center(25)) # 2 - Palindrome print('\n' + 'Task 1' + '\n') # # Background: A palindrome is a word that is the same...
00bcb9943a96d699ecb571730ab77f5204e9ce7e
myYearOfCode/noDaysOff-Calendar
/noDaysOff.py
5,227
3.609375
4
#!/usr/bin/python ''' This script will make and update a noDaysOff calendar. This is a calendar app designed to keep you doing things day after day simply because you dont want to break a streak. TO DO //fix weekend code. its off by a day. fix rollover periods, ie may to may, that has two febs in it, and I need to ...
0c86d4de02c2b5f0dcbcd0efe1af377fafcdde5d
MeRajat/tensorflow_workspace
/mnist.py
1,911
3.765625
4
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) # Initialisation of tf network # Place holder for input images # Here None specify the batch size and 28 * 28 specify the grayscale image matrix size X = tf.placeholder(dt...
10961ada04c0d4900c1ca1e222b680365f8901ac
ProgrammerByte/Python-Tkinter-Ship-Control
/asteroids.py
6,169
3.90625
4
from tkinter import * import math #To do: add shooting that wraps around the screen along with the asteroids, learn more about how the game "asteroids" works class window(): def __init__(s): s.root = Tk() s.root.title("Asteroids!") s.root.grid() s.root.bind("<KeyPress>"...
fea02b332bf9c4ba4fea9fc85ce93b95b38ac259
JUMAAAN/programmerscodetest
/스택큐/프린터.py
613
3.578125
4
def solution(priorities, location): answer = 0 total=len(priorities) while priorities != []: mac=max(priorities) top=priorities.pop(0) print(location) print("탑",top) print(mac) if top != mac : priorities.append(top) if location==0: ...
367c46b4006dbfa582a43c20fad9867fa7d7ad82
DanielTongAwesome/web_linux_backend
/CodePY.py
1,427
3.5
4
''' Date: May 26, 2018 Author: Daniel Tong, LF112 ''' import os class executeCommand(object): path, filename = (None, None) # initialize param def __init__ (self): self.excommand = None pass # start to run and execute command def start(self): #check the command.txt ass...
579dc123a71ad379a4bea69398ecca6ecd4d54ff
gselgin/RestaurantModel
/main.py
343
3.515625
4
# Greg Elgin # Last Updated: 3/23/20 # Creates a restaurant object and simulates a day in the restaurant # Unit testing used to verify all methods work as they should import restaurant import simulate def main(): my_restaurant = restaurant.Restaurant() my_simulation = simulate.Simulate(my_restaurant) my...
7473187eb899dfaf8f409aae4424c0fbc4ccb6f1
interviewprep/InterviewQuestions
/trees/python/column_order_traversal.py
1,028
4.3125
4
# Column Order Traversal # Write a traversal method for Binary Tree that prints nodes that fall on a # line from leftmost to rightmost. # Example: For following Binary Tree, # # 4 # / \ # 2 5 # / \ \ # 1 3 7 # # Column order traversal = [1, 2, 4, 3, 5, 7] # # Explanation: If we draw lines v...
b74184838111476129625eb2f3b1f26e6f189b4f
interviewprep/InterviewQuestions
/stacksandqueues/python/reverse_parentheses.py
1,304
4.15625
4
# You are given a string s that consists of lower case English letters and brackets. # Reverse the strings in each pair of matching parentheses, starting from the innermost one. # Your result should not contain any brackets. # Example 1: # # Input: s = "(abcd)" # Output: "dcba" # # Example 2: # # Input: s = "(u(love)...
aa7720a3e570e36eb992dcd33cb0ad4a4a102942
wellfrog16/python-hw
/lesson5.py
819
3.75
4
#encoding:utf-8 class Person(object): def __init__(self, name, score): self.name = name self.__score = score def get_grade(self): if self.__score >= 80: return u'A-优秀' if self.__score >= 60: return u'B-及格' if self.__score <60: return ...
86196f2b2663b2b5a5da6a1a0ed3c5f5686c6654
ivo-pontes/Python3
/ed/Queue.py
1,035
4.375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -* ''' Classe Fila FIFO = FIRST IN FIRST OUT ''' class Queue: #Fila def __init__(self): self.queue = [] self.size = 0 ''' Insere ao fim da fila ''' def push(self, item): self.queue.append(item) self.size += 1 ''' Remove o primeiro item da fila ''' def pop...
abc2a32c20ea6dbde4fcdc4eb3ca6a68bf99dd83
tanvir-tech/PythonPractice
/3_Exception_handling/3_Raise_Exception.py
168
3.609375
4
x = "hello" try: if not type(x) is int: raise TypeError("Only integers are allowed") # raising exceptions except TypeError: print("type error")
7b1b3aeb4c16fa98372cab6b7fe93699da39710e
tanvir-tech/PythonPractice
/2_function/Generator/generator_5_expression.py
210
3.609375
4
numbers = range(5) gen_obj = (x for x in numbers) # generator expression print(gen_obj) print(next(gen_obj)) print(next(gen_obj)) print(next(gen_obj)) print(next(gen_obj)) print(next(gen_obj))
061475b877f574c7f56842f334dafe5de15b4172
tanvir-tech/PythonPractice
/4_Input-Output/1_split_multiple_input.py
179
3.78125
4
a,b,c = map(int,input("1.Enter 3 Integer by space:").split()) print("a+b+c =",a+b+c) a,b = b,a print("Swapping a,b => ",a,b) s = input("2.Enter any String :") print(s,type(s))
821b83db33743ddef6d4cc4ea13861a9ed1aa5b1
tanvir-tech/PythonPractice
/9_Socket_&_Request/TCP_Client.py
1,069
3.65625
4
import socket import sys try: s = socket.socket() # creating socket object print("Client socket created") except socket.error as err: print("Client socket creation failed",str(err)) sys.exit() server_ip = input("Enter the server name :") server_p...
36c657b59a5572d9fc023fb426d350fef5ac3221
tanvir-tech/PythonPractice
/2_function/21_Basic_Functions/2_function_adv.py
587
3.875
4
def mainfunc(n): def func1(): return "I am Function_01" def func2(): return "I am Function_02" if n==1: return func1() #returning function1..........................(python_Special) elif n==2: return func2() #returning function2..........................
b9d61fe0153a6391874b29677950c2b2369f4250
tanvir-tech/PythonPractice
/2_function/Recursion/recursion_1_Factorial.py
309
3.515625
4
# factorial function import sys sys.setrecursionlimit(10000) def factorial(n): print(n,end="*") if (n == 0) : return 1 # ................................base case else: return n*factorial(n-1) # .................recursive case result = factorial(4) print('') print(result)
451fe40bb8f45ec00879dcafa502da34866ccd9e
brianrodham/tensor_flow_playground
/Simple_MNIST.py
1,919
3.65625
4
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) # Only return the highest probability digit # x is placeholder for the 28 X 28 image data x = tf.placeholder(tf.float32, shape=[None, 784]) # 784 pixels # y_ is called "y ...
cab828cd25c57e81838ce3c8b92fcf06de324083
pbragapassarelli/Advent-of-Code-2020
/Day4/solution.py
3,459
3.75
4
input_data_file = 'input.txt' def read_input_file(input_data_file): with open(input_data_file, 'r') as input_data_file: return input_data_file.read() def make_passport_list(input_data): passports = input_data.split('\n\n') return [i.split() for i in passports] def get_fields_list_from_item(pass...
9f6cf9a8e5dc11dcc17171af6f6d405a4727bb62
jimfingal/polyglot-euler
/python/E005.py
607
3.734375
4
def all_factors_divide(number, factors): for factor in factors: if number % factor != 0: return False return True def get_solution_six(highest): current = highest factors = range(highest - 1, 0, -1) while True: if all_factors_divide(current, factors): return...
cd52914ac3a4f178f5e1b7f655ef6a1ffdae82d2
mparekh3/Bowling_Lane_Booking
/bowlinglane.py
4,058
4.09375
4
import datetime class Customer: """ This class is define custormers` values like Lane, Booking Time and Bill. """ def __init__(self): self.lane = 0 self.bookTime = 0 self.bill = 0 class Bowlinglane: """ This Class defines functions of the bowling lane system. Inclu...
8550bc8bf87cd47535d54bb887661632de70606e
PrimeIdeal/Fundamentals
/python/structures/linked_list.py
9,066
3.90625
4
from __future__ import annotations from typing import ( Any, List ) class linked_list: """ A simple linked list where each node contains a value and a reference to the next node in the list. """ def __init__(self, node_list: List[Any] = None): """ Constructor for the link...
772abac529e84752ce1d381fb7ab8f00549b3147
196803693/automation_framework_demo
/testCode/test_yield.py
172
3.546875
4
def fab(max): n,a,b = 0,0,1 while n < max: yield b a,b = b,a+b n += 1 f = fab(8) print(next(f)) print(next(f)) print(next(f)) print(next(f))
604dbf6eac794b3f6b382bdb19c1d01a6eaaa351
xeeeion/Python_unI
/Pr2/Pr_2/9.1. Книги на лето.py
252
3.625
4
in_home_books = int(input()) for_school_books = int(input()) wbooks = [] for i in range(in_home_books): wbooks.append(input()) for j in range(for_school_books): a = input() if a in wbooks: print("YES") else: print("NO")
8b86a96d67f9c18bf0a5e8e407aefbd62752e932
xeeeion/Python_unI
/Pr2/Pr_2/11.3. Именно та буква.py
207
3.828125
4
string = input() n = int(input()) symbol = input() if (0 < n <= len(string)) and (symbol in string) and (len(symbol)==1): print("НЕТ") if string[n] == symbol else print("ДА") else: print("err")
e8116d7abdffeac234e10efc6865984889dc2ad3
xeeeion/Python_unI
/Pr2/Pr_2/10.5. Продолжайте говорить «А».py
147
4
4
while True: data = input() n = (data[0]) if n == "а" or n == "а": print("OK") elif n != "а" or n != "а": break
39739dea88943a92a607868a75d6237a1dd59082
xeeeion/Python_unI
/Pr2/Pr_2/11.5. Буквоедство.py
96
3.84375
4
string = list(input()) while len(string) >= 1: print(str(string)) string = string[1:-1]
22d31897e15d7082de9f2b304d55c496c4faa41b
dewetbaumann/python
/problem 4/problem4.py
551
3.921875
4
from os import system as console console('color 0b && cls') mes = input('ingrese el mes: ').lower() if mes == 'abril' or mes == 'junio' or mes == 'septiembre'or mes == 'noviembre': print ('El mes trae 30 dias') elif mes == 'enero' or mes == 'marzo' or mes == 'mayo' or mes == 'julio' or mes == 'agosto' or mes == ...
43780ff03d9c9c8d4222e8d07d134edaf802854a
GabiAguirre/empanada
/viajante/bestHeu.py
596
3.59375
4
import busHeu def busquedaHeuTotal(Capitales): #esta funcion utilizara la busqueda heuristica por origen y las comparara # devolviendo la mejor de ellas mintot=1000000 for i in range(len((Capitales))-1): resultado=busHeu.BusquedaHeuristicaDeUnOrigen(i+1,Capitales) if resultado.get("total")<mintot: ...
d6ab5e83c842579911b3e6504ec2f9aa288604d6
natacadiz/Nata
/Ejercicios Unidad 1/1.4.py
299
4.125
4
# Escribe un programa que le pida al usuario una temperatura en grados Celsius, la convierta a grados Fahrenheit e imprima por pantalla la # temperatura convertida. celsius=float(input("Cuantos grados celsius hace?: ")) fahrenheit= (celsius*9/5)+32 print ("Hace",fahrenheit,"grados Fahrenheit")
f0249e0d575b148a35c03c147ba40bc6a07de410
natacadiz/Nata
/Ejercicios Unidad 2/Ejercicio 2.3.py
929
3.90625
4
# Escribe un programa que solicite una puntuación entre 0.0 y 1.0. Si la puntuación está fuera de ese rango, muestra un mensaje de error. # Si la puntuación está entre 0.0 y 1.0, muestra la calificación usando la tabla siguiente (el programa debe mostrar la tabla usando tabuladores): # Puntuación Calificación # >= 0...