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
d01aeee5083db5acb0752408529cb09b5da8f5ec
MarkClerigo/fcpc_python_projects
/simple_cash_register_clerigo.py
3,214
3.96875
4
list_product=["Piattos", "V-cut", "Chippy", "Mr.Chips", "Tostillas", "RollerCoaster", "ChizCurls", "LaLa", "CloverChips", "Marty's"] list_price=[13, 14, 7, 8, 8, 6, 6, 7, 8, 7] for x in range(10): print((x + 1), ".", list_product[x], "-", list_price[x]) print() select = input("Select: ") if select == "1": ...
8e52563d6b1116e96f3dd6ca28edab19f98892c2
Shaigift/Python-Practice-2
/Excercise5.py
191
3.59375
4
def wordmatch(words): thematch = 0 for x in words: if len(x) > 2 and x[0] == x[-1]: thematch += 1 return thematch print(wordmatch(['abv','ced','etf','rtr']))
9c78b659aae8780cd25de99dcdf2c6dc97d1d5f6
Shaigift/Python-Practice-2
/Python Basics/Task Thirty-four.py
145
3.671875
4
def z(x,y): z = x + y if z in range(15, 20): return 20 else: return z print(z(10,7)) print(z(10, 3)) print(z(10,67))
3e3a82314bf248d8f8b5c690af0b3a942e46826d
michaelflore/python-practice
/Practice/practice.py
2,005
4.09375
4
# Global Variables position = "Student" # Method to tell what position he really is, indent is important with methods # Make sure there are 2 blank lines after def myfunc(): position = "Web Developer" print("Michael is a " + position) # Print out Global Variable print("Michael is a " + position) # Text and ...
89db88a19db985db60c3f610db26e072f387730b
jcubelo/chapter_practice
/3.4phoned.py
806
3.53125
4
###Package A: For $39.99 per month 450 minutes are provided. Additional minutes are $0.45 per minute. ###Package B: For $59.99 per month 900 minutes are provided. Additional minutes are $0.40 per minute. ###Package C: For $69.99 per month unlimited minutes provided. x = input("Which phone plan do you have (A, B, or ...
39a3d1289626367c500254aaa4ba9abc809f3b96
GGL12/myStudy
/leetcode/剑指offer/get_least_numbers.py
2,282
3.5625
4
class Solution: def get_least_numbers(self, tinput, k): self.max_heap = [] self.input_len = len(tinput) # 判断边际 if self.judge_input(tinput, k): for i in range(self.input_len): if i < k: self.create_max_heap(tinput[i]) els...
d06f62ffd22f0304e89a55be5c0e6b81d3ae19f3
GGL12/myStudy
/leetcode/剑指offer/multiply.py
439
3.5625
4
class Solution: def multiply(self, A): # write code here m1 = [] m2 = [] ans1 = 1 ans2 = 1 res = [] for i in range(len(A)): res.append(ans1) res.insert(0, ans2) ans1 *= A[i] ans2 *= A[len(A) - 1- i] i...
170ec3979a2e740d273d95f3434288e17a6ebb1f
GGL12/myStudy
/leetcode/剑指offer/tree_convert_to_chain.py
936
3.625
4
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def convert(self, pRootOfTree): if not pRootOfTree: return pRootOfTree if not pRootOfTree.left and not pRootOfTree.right: return pRootOfTree ...
037dcaa41c0f5dd51b9269bd02e4a61547843235
GGL12/myStudy
/leetcode/剑指offer/print_from_top_to_bottom.py
560
3.53125
4
class TreeNode: def __init__(self,x): self.val = x self.left = None self.right = None class Solution: def print_from_top_to_bottom(self, root): if root == None: return [] support = [root] ret = [] while support: tmp_node = support[...
feb2cd1edaa86e1edabb8d8fee27c9f96476e325
GGL12/myStudy
/leetcode/剑指offer/find_numbs_appear_once.py
1,239
3.515625
4
from collections import Counter class Solution: # def find_nums_appear_once(self, array): # nums_count = sorted(Counter(array).items(), key=lambda x: x[1]) # return nums_count[0][1], nums_count[1][0] def find_nums_appear_once(self, array): if len(array) < 2: return None ...
88743e3fb9f5d927f5c61d3d53d426857bdf0b14
GGL12/myStudy
/leetcode/剑指offer/min_number_in_rotate_array.py
845
3.515625
4
class Solution: def min_number_in_ratate_array(self, rotate_array): # min_num = 0 # for i in range(len(rotate_array)): # min_num = min_num if min_num < rotate_array[i] and min_num !=0 else rotate_array[i] # return min_num #最小值一定要比前面的要小 #二分法查找数据,找左右的方法是:中值小于右边的值,就...
bf9d611d432444dc806158274631f53a131759e6
davidportella/training
/string/main.py
705
4.0625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'davidportella' import string import random # Funcion para generar un string random def random_string(param): # inicializamos variables cadena = "" r = 42 choices = string.ascii_lowercase + string.digits + string.punctuation # validamos...
fc021535da02321cd9178c8aeea421d04f0f81d9
DavidYunGitHub/Wed-HW
/loopexercises.py
286
3.984375
4
# Assignment 1 # for x in range(1,11): # print(x) # Assignment 2 # begin = input("Start number: ") # end = input("End number: ") # for x in range(int(begin), int(end)): # print(x) # Assignment 3 # for x in range(1,11): # if x % 2 == 1: # print(x) # Assignment 4
7b2d778460d6b1bf5936ba893db66d01cc0a3a47
sathoune/shop_record
/sql/database_scripts/ordered_items_database_class.py
4,002
3.65625
4
""" This file contains a class OrderedItems and it"s methods, that carry operations on ordered Items """ import sql.sql_variables.sql_variables as db_constants from sql.database_scripts.database_class import Database class OrderedItems(Database): """ This class handles operations on table containing orderedIt...
fa868060203540fb4a73bb64e09b33c622873479
devsnice/data-structures-algorithms
/algorithmic-toolbox/week-5/moneyChange.py
703
3.71875
4
# Uses python3 import math import sys def moneyChange(coins, money): minNumberOfChangesForCoins = [0] index = 1 while index <= money: minNumberOfChanges = math.inf for coin in coins: if index >= coin: numberOfChanges = minNumberOfChangesForCoins[index - coin] ...
582abceeaaa17fc716bf2ad6ac35110f3e739e50
sabiyamalbari/Automated_diet_planner.github.io
/mariya/bmi.py
208
3.859375
4
weight = float(input('Your weight in kilos: ')) height = float(input('Your height in cms: ')) abc = height / 100 print ('abc',abc) defg= abc * abc print ('defg',defg) BMI = weight / defg print ('jkl' ,BMI)
c7757adde0aaf694e7671da1cf885660c724becb
conicRelief/Random-Things-from-my-Comp
/Miscellaneous Projects/Non Web/Miscellaneous Scripts/lambda_proving_grounds.py
647
3.65625
4
# # def f (x): return x**2 # print f(8) # # g = lambda x: x**2 # # print g(8) # # def make_incrementor (n): return lambda x: x + x # # f = make_incrementor(2) # g = make_incrementor(6) # # print f(42), g(42) class lambdaJuggler: value = 0 def __init__(self, val = 0): self.value = val def retu...
2e19838977368c81847cb523e06b0852ad21876d
mawothe/python-challenge
/PyBank/main.py
1,824
4.09375
4
#Name: Marie Wothe #Homework 3: Python Challenge: PyBank #Dependencies import os import pandas as pd #Find and read data into data frame from Resources folder budget_csv = os.path.join("Resources", "budget_data.csv") budget_df = pd.read_csv(budget_csv) #The total number of months included in the dataset months_total...
157677c2d65797724248e4bec4396ffc2f698b5d
samirghouri/DS-and-ALGO-In-Python
/Recursion/recursion1.py
1,480
4.34375
4
# Lets take a look at the Fibonacci Series Example # We have the following conditions # F(0) = 0, F(1) = 1, F(2) = F(1) + F(0) , F(3) = F(2) +F(1) and so on # 0,1 when n =0,1 # F(n) = # F(n-1) + F(n-1) when n >=2 # Lets implement the function using two methods - 1.Iteratively 2. Recursively # 1.Ite...
0fe555f754b52298cf3489af3f132223509018bc
samirghouri/DS-and-ALGO-In-Python
/Priority_Queues/heap_sort.py
2,121
4.03125
4
# Basic Plan of Action # Make a minHeap # take the root elements out and store it in some list one by one # return the list class HeapSort(object): def __init__(self): self.min_heap = MinHeap() def heap_sort(self, array): self.min_heap.build_heap(array) sort_array = [] for i i...
a2174dac1e9c52d714bad7d0fd82c1763a21a6d1
samirghouri/DS-and-ALGO-In-Python
/Stacks and Queues/queue_linkedlist.py
1,132
4.0625
4
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None class Queue: def __init__(self): self.llist = Linkedlist() def enqueue(self, data): new_node = Node(data) if self.llist.head...
2d499e1bafe012068d0fb5e4acc63d7aa8edc3c7
QuantumCalzone/pythonmiscscripts
/extract_urls_from_clipboard.py
555
3.703125
4
import clipboard import re as regex # everything_before_pattern = regex.compile("^(.*?)http") everything_after_pattern = regex.compile("^(.*?)http") text = clipboard.paste() textlines = text.splitlines() urls = [] urls_to_copy = "" for textline in textlines: if "http" in textline: urls.append(textline) fo...
659d738988e4b016647f0e297516b91fcab1752c
swaraleepanpatil/IOT
/day1/4led_4blink.py
1,155
3.71875
4
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library from time import sleep # Import the sleep function from the time module GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) # Use physical pin numbering #GPIO.setup(5, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and set ini...
fef5ec7adb7bc631eed1009762dca0fb26d35e7b
LGsus22/EVALUACIONGIT
/Personal.py
2,290
3.921875
4
"""Archivo para las clases""" print("Archivo modificado en pycharm") class Gerente: def __init__(self, Nombre, Altura, Vestimenta): self.__Vestimenta=Vestimenta self.__Altura=Altura self.__Nombre=Nombre def status(self): print("El gerente de la empresa es un empleado que mide ", ...
a5405798c83b1ecc5b8095b4a8251ea3d6aa8fea
bapadman/PythonToddlers
/pythonTutorialPointCodes/IfElse.py
277
4.1875
4
#!/usr/bin/python # classic if else loop example flag = True if not flag: print("flag is true") print("Printing from if loop") else: print("flag is false") print("Printing from else part") #while loop sample i = 0 while i < 10: print("i = ",i) i = i +1
84871242e8a26e57b826ec8a4f0cd94773a65619
shaunnnorton/SuperHeroTeamDuler
/animal.py
399
3.8125
4
class Animal: def __init__(self,name): self.name = name def eat(self): print(f"{self.name} is eating.") def sleep(self): print(f"{self.name} is sleeping.") class Frog(Animal): def jump(self): print(f"{self.name} is jumping.") Cat = Animal("Turtle") Chicken = Frog("H...
509e39071d5a5ceafcb939fccbb3cd070552e957
hamukazu/primenumber_bot
/prime.py
1,303
3.734375
4
#!/usr/bin/env python import sys import random SMALL_PRIMES=[] LIMIT_SMALL_PRIMES=100 def prepare(): f=[True]*LIMIT_SMALL_PRIMES for i in range(2,LIMIT_SMALL_PRIMES): if f[i]: SMALL_PRIMES.append(i) j=i while j<LIMIT_SMALL_PRIMES: f[j]=False ...
21233a0616ff7f303fe9b8f6206f8b66e25e576c
ChrisViral/AdventOfCode
/2018/Python/Challenges/Day11.py
2,265
3.765625
4
import sys from typing import List, Tuple def main(args: List[str]) -> None: """ Application entry point :param args: Argument list, should contain the file to load at index 1 """ # Setup data width: int = 301 # We're not using Grid yet here because this algorithm is already too slow and ...
4478fb8c624145a053e8f219731918ec046ada24
ChrisViral/AdventOfCode
/2018/Python/Challenges/Day12.py
5,103
3.546875
4
from __future__ import annotations import sys import re as regex from typing import List, Pattern, Dict class Node: """ Decision tree node """ def __init__(self, depth: int, name: str = "") -> None: """ Creates a new decision tree node :param depth: Depth of the tree from this...
a1f57f8d73cafd0414b7361b6a4a2e544aef3e9f
ChrisViral/AdventOfCode
/2019/Python/Challenges/Day11.py
2,404
3.8125
4
import sys from typing import List, Set, Tuple, Final from utils import IntcodeComp, Grid, Vector, Direction from threading import Thread import time def main(args: List[str]) -> None: """ Application entry point :param args: Argument list, should contain the file to load at index 1 """ # File re...
51b0257e29c3fab2e9efb3c7dd687a7d5714780d
ChrisViral/AdventOfCode
/2019/Python/Challenges/Day8.py
1,550
3.640625
4
import sys from typing import List, Final def main(args: List[str]) -> None: """ Application entry point :param args: Argument list, should contain the file to load at index 1 """ # Image info width: Final[int] = 25 height: Final[int] = 6 stride: Final[int] = width * height # Fil...
0fd5858a5e14b3d692cc71d59a6181acea35fa3b
briworkman/Sprint-Challenge--Graphs
/adv.py
3,297
3.6875
4
from room import Room from player import Player from world import World import random from ast import literal_eval # Load world world = World() # You may uncomment the smaller graphs for development and testing purposes. # map_file = "maps/test_line.txt" # map_file = "maps/test_cross.txt" # map_file = "maps/test_lo...
02d5d7e8bb65a5a4cdf0c510eab524cb9d36a72f
ardaneshwara/Ardaneshwara-Gea_I0320012_Wildan_Tugas3
/I0320012_soal1_tugas3.py
630
3.84375
4
# Menampilkan list 10 teman list = ['Deadila','Bagus','Aratia','Sekar','Alifiana','Funny','Ayu','Hana','Candrika','Angela'] # Menampilkan isi list indeks nomor 4, 6, dan 7 print("List indeks nomor 4,6, dan 7 yaitu", list[4],",", list[6], ",","dan", list[7]) # Mengganti nama teman di list 3, 5, 9 list[3] = 'Divana' li...
02c7a66f6d147c7f6a5bee36d74f61fcc05eb657
abebinder/josephus
/josephus.py
246
3.953125
4
def josephus(n): return (n - biggest_power_of_two(n)) * 2 + 1 def biggest_power_of_two(n): counter = 0 while (n > 1): n //= 2 counter += 1 return 2 ** counter if __name__ == '__main__': print(josephus(41))
72a01a2841507244f13248d83aa771826c78427d
dirdr/pendule-double
/pendulum.py
3,029
3.625
4
from typing import Tuple from math import sin, cos, pi, pow import pygame class Pendulum: def __init__(self) -> None: self.x1 = None self.y1 = None self.x2 = None self.y2 = None self.angular_acceleration1 = 0 self.angular_acceleration2 = 0 self.angular_v...
528246fe5152ce79ab487a276c77cc9db165a5f8
DetectiveStrawberry/CoffeeMachineCreative
/coffee_machine.py
5,995
3.984375
4
class CoffeeMachine: revenue = 0 products_sold = 0 water = 0 milk = 0 coffee_beans = 0 cups = 0 money = 0 functions_list = ["buy", "fill", "take", "remaining", "stats", "exit"] coffee_types = ["1", "2", "3", "back"] def __init__(self, water, milk, coffee_beans, cups, ...
550bfac532b7f98b3adadd9bdd052e90f5e5dbce
beatrizvalfranco/learning-python
/exemplo1865.py
289
3.6875
4
def main(): N = int(input()) for i in range(N): infos = input() splitted_infos = infos.split() name = splitted_infos[0] if name == "Thor": print("Y") continue print ("N") if __name__ == "__main__": main()
9d72471eacf4658d48bb5635c262485ec253694c
beatrizvalfranco/learning-python
/exemplo1071.py
232
3.59375
4
def main(): x = int(input()) y = int(input()) sum_odds = 0 for i in range(min(x,y)+1, max(x,y)): if i%2 == 1: sum_odds += i print(sum_odds) if __name__ == "__main__": main()
87f9f4758d8e7ce4f70d1f9d0a1a9e192189dcc2
beatrizvalfranco/learning-python
/oki.py
434
3.65625
4
def distribution(): balls = int(input()) bucket_1 = [] bucket_2 = [] bucket_3 = [] for ball in range(balls): novo_elemento = ball + 1 bucket_1.append(novo_elemento) bucket_2.append(novo_elemento) bucket_3.append(novo_elemento) buckets = [bucket...
29ed96dc1850aaa0a5c1bd223fb2a980c4f8b8ae
Jorge-Polanco-Roque/Codeando
/pdf2speech.py
4,345
3.515625
4
#import libraries from tkinter import * from gtts import gTTS from playsound import playsound import PyPDF2 import textract import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords nltk.download('punkt') nltk.download('stopwords') #Here Tk() is used to initialize tkinter which ...
675b3a9edf08ea464d818639065a5ff1c06eccd7
gslmota/Programs-PYTHON
/Exercícios/Mundo 3/ex086.py
1,136
3.703125
4
# Aprimoramento de cadastro de jogador time = list() jogador = dict() partidas = list() while True: jogador.clear() jogador['nome'] = str(input('Digite o nome: ')) tot = int(input(f'Quantas partidas {jogador["nome"]} jogou?')) partidas.clear() for c in range(0,tot): partidas.append(int(inpu...
6c3e4183c9e1da1bc62cb53cf515804cd39fffcc
gslmota/Programs-PYTHON
/Exercícios/Python Orientado a Objetos/07/main.py
258
3.5
4
# Conceito de herança simples #falta terminar o curso completo dele na udemy from classes import * c1 = Cliente('Luiz', 23) print(c1.nome, c1.idade) c1.falar() c1.comprar() a1 = Aluno('Gabriel', 32) a1.falar() a1.estudar() p1 = Pessoa('Joao', 43) p1.falar()
12e1b7a3613ff30f58297f3d9bd670acdb1beb98
gslmota/Programs-PYTHON
/Exercícios/Mundo 1/ex016.py
485
4.15625
4
# nome da pessoa e informações nome = str(input('Digite o nome: ')).strip() # serve para eliminar os espaços print( 'Seu nome em maiúsculas é: {}'.format(nome.upper())) print('Seu nome em minúsculas é: {}'.format(nome.lower())) print('Seu nome tem {} letras'.format(len(nome) - nome.count(' '))) print('Seu primeiro nom...
678929b3f882b2cc99929af20fe8482bcd7cb700
gslmota/Programs-PYTHON
/Exercícios/Mundo 3/ex089.py
453
3.828125
4
from time import sleep # Função que realiza contagem def contador(i, f, p): if f > i: for x in range(i, f, p): print(x) sleep(0.5) else: for x in range(i, f, -p): print(x) sleep(0.5) # programa principal ini = int(input('Digite o inicio da conta...
40759e3571db366be7876ea480a517816a31d7db
gslmota/Programs-PYTHON
/Exercícios/Mundo 3/ex081.py
386
3.921875
4
# Cadastro e situação de aluno usando dicionarios aluno = {} aluno['nome'] = str(input('Digite o nome do aluno: ')) aluno['media'] = float(input('Digite a media do aluno: ')) if aluno['media'] >= 7: aluno['situação'] = 'Aprovado' else: aluno['situação'] = 'Reprovado' print(f'O aluno {aluno["nome"]} tem media {...
6e03e467a06a4271e4450a05dbceb3506996fe22
gslmota/Programs-PYTHON
/Exercícios/Mundo 1/ex020.py
292
3.953125
4
# verifica frase frase = str(input('Digite um frase: ')).lower().strip() print(' A letra A aparece {} vezes'.format(frase.count('a'))) print('A primeira letra A apareceu na posição {}'.format(frase.find('a')+ 1)) print('A últoma letra apareceu na posição {}'.format(frase.rfind('a')+ 1))
5a5409a60b3a26137851c5af9f4d72863cfb56c6
gslmota/Programs-PYTHON
/Aulas/a012.py
759
3.875
4
# Aula de listas parte 2 teste = list() teste.append('Gustavo') teste.append(40) print(teste) teste = list() teste.append('Gustavo') teste.append(40) galera = list() galera.append(teste) print(galera) galera = [['joao', 23], ['maria', 43], ['pedro', 23]] print(galera) for p in galera: print(f'{p[0]} tem {p[1]} a...
0451dba930d6166fa5dfca473ef255998a331e55
gslmota/Programs-PYTHON
/Exercícios/Mundo 3/ex063.py
271
3.984375
4
# Tupla de 0 até 10 nextensos = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez') while True: n = int(input('Digite um número: ')) if n >= 0 and n <= 10: break print(f'O numero {n} por extenso é {nextensos[n]}')
b97b5789ab7c017e1dc4c9888f608678cb9c5c7f
gslmota/Programs-PYTHON
/Exercícios/Mundo 2/ex053.py
248
3.953125
4
# Soma dos valores de uma PA 2.0 ptermo = int(input('Digite o primeiro termo: ')) raz = int(input('Digite a razão: ')) print('Os 10 primeiros termos: ') c = 10 while c >= 1: print('{}'.format(ptermo)) ptermo += raz c -= 1
d759c2c4c078de2b68acc488766fa016f9ee1a6f
gslmota/Programs-PYTHON
/Exercícios/Mundo 2/ex052.py
264
3.9375
4
# Fatorial com while n = int(input('Digite um numero: ')) c = n f = 1 print('Fatorial de {}! = '.format(n, end = '')) while c > 0: print('{} '.format(c, end = '')) print('x' if c > 1 else '=', end = '') f *= c c -= 1 print('{}'.format(f, end = ''))
7604537c71142580cac2e42afb4ee9f484816477
gslmota/Programs-PYTHON
/Exercícios/Mundo 1/ex00.py
428
4.21875
4
# Desafio 4 Aula 6 # Mostra informações sobre o tipo prmitivo txt = input('Digite alguma coisa: '); print('O tipo primitivo de {} é {}'.format(txt, type(txt))); print('Só tem espaços? {}'.format(txt.isspace)); print('É um número? {}'.format(txt.isnumeric)); print('É alfabético? {}'.format(txt.isalpha)); print('É alfa...
f9f23497985df30ee5acc29607e331f60c76b887
WeilinXu/deeplearning_hw
/deeplearning_hw/Homeworks/Homework1/my_code/layers.py
25,569
3.75
4
from builtins import range import numpy as np def fc_forward(x, w, b): """ Computes the forward pass for a fully-connected layer. The input x has shape (N, Din) and contains a minibatch of N examples, where each example x[i] has shape (Din,). Inputs: - x: A numpy array containing input data, of shape (N, Din)...
623e9f014402b3080078b75c91eb2279773d9c9b
Naveenkhasyap/NLTK_LABS
/sentimental_tweet_analyze.py
2,611
3.578125
4
import tweepy import matplotlib.pyplot as plt from textblob import TextBlob #function to return percentage def percent(part,whole): return 100* float(part)/float(whole) #twitter credentials needed to get access for tweets consumer_key = #consumer key from https://apps.twitter.com consumer_secret = #consumer se...
24feca35f3cf27423dab70e2796561d55b38ff93
DawidPL/stockPy
/src/Charts.py
329
3.65625
4
import matplotlib.pyplot as plt from src.UserCalculators import UserCalculators a, b, c = [int(input("podaj liczby")) for i in range(3)] def chart_folding_percent(): plt.plot(UserCalculators.folding_percentage(a, b, c)) plt.ylabel('Zysk') return plt.show() if __name__ == "__main__": chart_folding_p...
3432d1d403658ed2fb19dc9f372e0c98dda29bc1
YuweiHuang/Basic-Algorithms
/leetcode/tree/116.填充每个节点的下一个右侧节点指针.py
1,182
3.78125
4
# # @lc app=leetcode.cn id=116 lang=python3 # # [116] 填充每个节点的下一个右侧节点指针 # # @lc code=start """ # Definition for a Node. class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right sel...
c9165e8a39a4b2f2105967d2137ad7b135e10d65
YuweiHuang/Basic-Algorithms
/leetcode/tree/145.二叉树的后序遍历.py
964
3.734375
4
# # @lc app=leetcode.cn id=145 lang=python3 # # [145] 二叉树的后序遍历 # # @lc code=start # 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 TreeNode(object): """ docstrin...
708ebee04f2f835a937edefaa8b01fddf816e8dd
manurua123/python2020
/Actividad 11-5 PythonPlus/hangman.py
3,916
3.8125
4
import random HANGMAN_PICS = [''' +---+ | | | ===''', ''' +---+ O | | | ===''', ''' +---+ O | | | | ===''', ''' +---+ O | /| | | ===''', ''' +---+ O | /|\ | | ===''', ''' +---+ O ...
a395f5b4005996bfacc10a38800f45f6d92ca2e6
manurua123/python2020
/Practica2/ejercicio10.py
558
3.625
4
imagenes = ['img1', 'img2', 'img3'] lista_cord= [] lista = [] for i in imagenes: print('Ingrese cordenadas x e y para el elmento',i) x=int(input("Cordenada X:")) y=int(input('Cordenada Y:')) for j in lista_cord: while(x == j[0]) and (y== j[1]): print('ERROR: cordenadas ya ut...
917ca1da5f5f88f1c36b19860fedbd4321489b9b
Boseka/simple-python-projects
/if-statment-game.py
3,505
3.859375
4
#To use green color,these colors will work only in *NIXs, if you want to run the code on windows, just remove these two lines:: G = '\33[92m' # Red color: R = '\33[91m' n = str(R + "All we had is one simple rule you little shit, answer yes or no, \nif this is so hard for you, you really need some pro help !!") m = s...
93f03c55645afe57bf69c44362fd5183cf3a4b11
htqlinn/SudokuSolver
/SudokuSolver.py
1,874
3.84375
4
#sudokuSolver board = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def printBoard(board): for i in range(9): if i % 3 == 0 ...
55306a5cb494265ccaec0969650a6f311fe7270f
finolex/Python_F18_Abhiroop
/Lab 3 - Booleans/q3.py
485
4.125
4
import math firstLeg = int(input("Please enter the length of the first leg: ")) secondLeg = int(input("Please enter the length of the second leg: ")) hyp = float(input("Please enter the length of the hypothenuse: ")) hypCalc = math.sqrt(firstLeg**2 + secondLeg**2) if hyp == hypCalc: print("This forms a right ang...
5b275184d7845c54e6b3427b353d49d1e9fa22ba
finolex/Python_F18_Abhiroop
/Lab 4 - While loops/q3.py
247
4.15625
4
dividend = int(input("Please input a positive int for dividend: ")) divisor = int(input("Please input a positive int for divisor: ")) count = 0 quotient = dividend while quotient >= divisor: quotient -= divisor count += 1 print(count)
b06ac0578de80929a267d586f9ba7921db9c38d2
finolex/Python_F18_Abhiroop
/HW 3/ac5847_hw3_q2.py
952
3.921875
4
import math item1 = float(input("Please input price of first item without dollar sign, and to 2dp: ")) item2 = float(input("Please input price of second item without dollar sign, and to 2dp: ")) print("There is an offer for buying 2 items! You get the lower priced item at 50% off!") card = input("Are you a card memb...
a803d99a67e3165c413580059a88e8cfc3852224
finolex/Python_F18_Abhiroop
/HW 2/ac5847_hw2_q5.py
734
3.9375
4
J_days = int(input("Please enter number of days John worked: ")) J_hours = int(input("Please enter number of hours John worked: ")) J_minutes = int(input("Please enter number of minutes John worked: ")) B_days = int(input("Please enter number of days Bill worked: ")) B_hours= int(input("Please enter number of hours Bi...
6949c50c9c2e70ad361aac5fb66b82a49e91624b
finolex/Python_F18_Abhiroop
/Lab 4 - While loops/q2.py
175
4.3125
4
string1 = input("Please enter a string to check if palindrome: ") if string1[::-1] == string1: print("This is a palindrome!") else: print("This is not a palindrome")
5c624b55e026aa8c9c506162767176dd19e4fd7c
finolex/Python_F18_Abhiroop
/Lab 3 - Booleans/q4.py
382
4.15625
4
num1 = int(input("Please enter your first integer: ")) num2 = int(input("Please enter your second integer: ")) if num2 == 0: print("This has no solutions.") elif (-num1/num2) > 0 or (-num1/num2) < 0: print("This has a single solution and x = .", (-num1/num2)) elif (-num1/num2) == 0: print("This has a singl...
69aa220a34896f8d7cf9b804ed9aa05956608b82
IgnacioCastro0713/exercises
/main/homework6/1.py
541
3.84375
4
# José Ignacio Menchaca Castro # 215818166 lista = ['Ana', 'Luis', 'Pedro', 'Juan'] x = 0 while True: print('Seleciona una opción de la lista a remplazar: ') for i in lista: x += 1 print(x, '.-', i) remove = int(input('Opcion: ')) lista.remove(lista[remove - 1]) print('Lista: ', li...
db942fa5bd05850df94bd88eb51d34b7cfd3aa5a
Reikonz/PythonLearning
/Basic Tutorial/string_formatting.py
180
4.09375
4
# python string operator name = "John" age = 23 print("Hello, %s!" %name) print("%s is %d years old." %(name, age)) #lists myList = [1,2,3] print("A list: %s" %myList)
30ae0ea3f951ffac097365bd41fa059808616ab4
Reikonz/PythonLearning
/Basic Tutorial/variables_types.py
444
4.0625
4
# python supports integers, floating point, and complex numbers myint = 7 print(myint) myfloat = 7.0 print(myfloat) myfloat = float(7) #typecasting print(myfloat) # handling strings mystring = 'hello' print(mystring) mystring = "hello" print(mystring) # operators one = 1 two = 2 three = one + two pr...
e15028f4b2857b74de6a883cd038debcb3c8a91e
ongsuwannoo/Pre-Pro-Onsite
/Grade.py
535
3.828125
4
""" Grade """ def main(): """ input score """ num = int(input()) if 0 <= num <= 100: if num >= 80: print("4") elif num >= 75: print("3.5") elif num >= 70: print("3") elif num >= 65: print("2.5") elif num >= ...
1379e620591bd5bc57c6df3c13550e03c6b09747
ongsuwannoo/Pre-Pro-Onsite
/Pancake Shop EP.5.py
358
3.640625
4
""" Pancake Shop EP.5 """ def main(): """ input """ num = float(input()) print("|--------|") print("|%-8.2f|" %num) print("|--------|") print("") print("|--------|") print("|%8.2f|" %num) print("|--------|") print("") print("|--------|") print("|%08.2f|" %num...
c4560293be628519f242be511c861de46a0e4e1c
ongsuwannoo/Pre-Pro-Onsite
/Super Extra Center_justify.py
151
3.5
4
""" [Super Extra] Center_justify """ def main(): ''' input ''' num = int(input()) cha = input() print(cha.center(num)) main()
699d56a45dcbb0d7a383cdb6c433e43250f57936
ongsuwannoo/Pre-Pro-Onsite
/Extra Print i.py
330
3.9375
4
""" [Extra] Print i """ def main(): ''' input ''' direction = input() num1 = int(input()) num2 = int(input()) for i in range(num1, num2 + 1 - (2 * (num1 > num2)), 1 - (2 * (num1 > num2))): print("%02d"%i + "\n" * (direction == "Vertical") + " " * (direction == "Horizontal"), end="") ...
f8840a1a7078fde032152520ca0952f3083b216c
ongsuwannoo/Pre-Pro-Onsite
/Custom Sign.py
702
4.03125
4
""" Custom Sign """ def main(): """ input """ scale = int(input()) name = input() name = name[:scale - 2] position = input() print("".ljust(scale, '*')) print("*"+" ".ljust(scale - 2)+"*") if position == "Left": print("*" + name.ljust(scale - 2) + "*") elif positio...
b6565abf891120359f217e53ab92b7c2f6477abc
ongsuwannoo/Pre-Pro-Onsite
/Cards Shuffling.py
395
3.65625
4
""" Cards Shuffling """ def main(): """ input """ nub = int(input()) if nub != 0: num1 = int(input()) nub1 = nub nub2 = 1 count = 0 while nub1 > 1 and nub != 0: num2 = int(input()) if num1 > num2 and count == 0: count = nub - nub2 num1...
337acbd692435f8866ee2b3f413f5051177d273f
ongsuwannoo/Pre-Pro-Onsite
/Boolean.py
142
3.734375
4
""" Boolean """ def main(): """ input number integer """ num = int(input()) numtf = (num % 2 == 0) print(numtf) main()
e4cf2da3b3e9f4b86a5306dccb8e0eb1d9e91d81
ongsuwannoo/Pre-Pro-Onsite
/Sentence.py
125
3.65625
4
""" Sentence """ def main(): """ input character""" num1 = str(input()) print("I want %s"%(num1)) main()
40b2810280915f35bd1ae79fb9d634c3e310f236
ongsuwannoo/Pre-Pro-Onsite
/Shopping List.py
413
3.765625
4
""" Shopping List """ def main(): ''' input ''' num = int(input()) name = [] cha = [] total = 0 for i in range(num): cha.append(input().split(", ")) name.append(cha[i].pop(0)) for i in range(len(cha)): total += len(cha[i]) print("Total:", total) ...
2e98ee26029d8de9052c361ebf2dff8944f01d15
ongsuwannoo/Pre-Pro-Onsite
/Middle Value.py
271
3.53125
4
""" Middle Value """ def main(): """ input """ num1 = int(input()) num2 = int(input()) num3 = int(input()) maxx = max(num1, num2, num3) minn = min(num1, num2, num3) med = (num1 + num2 + num3) - (maxx + minn) print(med) main()
b2b16a87fe5587345fa970a839aa0f0344520204
ongsuwannoo/Pre-Pro-Onsite
/Lane.py
273
3.53125
4
""" Lane """ def main(): """ input R L P""" num = 1 cha2 = "" while cha2 != "P": cha2 = input() if cha2 == "R" and num < 4: num += 1 elif cha2 == "L" and num > 1: num -= 1 print(num) main()
b56b8a726316dd3b138b38b2065f40a396e7bbc2
ongsuwannoo/Pre-Pro-Onsite
/Pizza.py
185
3.640625
4
""" Pizza """ def main(): """ input pizza """ count = int(input()) num = int(input()) process = (count // num) + ((count % num) > 0) print(process) main()
f0cba5e56beb39847a38ba44a1c825566974d4e5
ongsuwannoo/Pre-Pro-Onsite
/Extra NongHyun - Label Number.py
277
3.5625
4
""" [Extra] NongHyun - Label Number """ def main(): ''' input ''' num1 = int(input()) num2 = int(input()) num = [] for i in range(num1, num2+1): num += str(i) for i in range(10): print(num.count('%s'%i), end=' ') main()
c3e2dd28dfe3d6d2615d9b0db11f251976077d4f
ongsuwannoo/Pre-Pro-Onsite
/Extra Cryptography EP.2 - Caesar Out.py
385
3.9375
4
""" [Extra] Cryptography EP.2 - Caesar Out """ def main(): """ input charecter """ cha = ord(input()) if 65 <= cha <= 90: if cha < 88: cha += 3 elif cha >= 88: cha -= 23 elif 97 <= cha <= 122: if cha < 120: cha += 3 elif ch...
90eef677fbbf0a072bdcf0174482ee37be90497d
ongsuwannoo/Pre-Pro-Onsite
/Word Game.py
442
3.765625
4
""" Word Game """ def main(): """ input charecter """ cha1 = str(input()) num = 1 num2 = 100 num4 = 0 while num <= 20: cha2 = str(input()) if cha2 == cha1: num = 20 num4 = 1 num2 += 5 num += 1 num2 -= 5 if num...
53d3313881b538d2f32fde567bc95740b26dfa91
ongsuwannoo/Pre-Pro-Onsite
/Equation I.py
197
3.734375
4
""" Equation I """ def main(): """ input num """ import math num = float(input()) result = (2 * math.log10(num)) + (num / 3) * (num > 0) print("%.2f"%(result)) main()
172720a347baa8828443ba979fb4fe01b2e7f6f5
gabrielchase/MIT-6.00.1x-
/Week2/prob3.py
1,116
4.5
4
# Write a program that calculates the minimum fixed monthly payment needed # in order pay off a credit card balance within 12 months. By a fixed monthly # payment, we mean a single number which does not change each month, but # instead is a constant amount that will be paid each month. MONTHS_IN_A_YEAR = 12 # Given...
343c9a141b79c81063efbde5124c227a1a5200f4
haykarabyan/project2
/LinkedLIst.py
3,410
4
4
from datetime import datetime class Node: def __init__(self, val): self.value = val self.next = None self.prev = None class doubly_linked_list: def __init__(self, val=0): self.zero = datetime(1, 1, 1) val = self.zero self.head = Node(val) self.tail = ...
2c90d9205f3114b4a25bc2a4a7149f3f1c491502
arenAghajanyan/Intro-to-Python
/week3/Practical/Problem14.py
107
3.625
4
tup1=(1,2,3,4,5,6,7,8) print(tup1) l1=list(tup1) l1.pop(4) l1.insert(4, "Hello") tup1=tuple(l1) print(tup1)
37d99a2823ec16a50b4c9730852e615d20818869
arenAghajanyan/Intro-to-Python
/week2/Practical/Problem7.py
127
4.03125
4
str1="How are you John?" name="|My name|" str2=str1.replace("John", name) print(str2) str2=str1[0:12]+name+str1[-1] print(str2)
1508db9cbefd55d72c5d073eafc0edd9e4fd147f
arenAghajanyan/Intro-to-Python
/week3/Practical/Problem6.py
110
3.5
4
list=[1,2,3,4,5,6,7,8,9,0,1] list1=list.copy() print(list) list1.pop(0) list1.pop(4) list1.pop(5) print(list1)
e062d0dda925e47088965fe2f9ca289ada10acf3
DomBouman/todo-manager
/manager.py
1,802
4
4
class Manager(object): # Creating a function that takes an argument. def PrintList(self): # This will open my .txt file with read permissions. target = open("todos.txt", 'r') # This will print your .txt file. print(target.read()) # This will close the target and remove the ...
c64d4f5203a49f7c6eef10a04f9ba9703e0b0800
ironidev/Python-Kriptografi
/lesson-2.py
931
3.671875
4
############################################################### # Sandi Caesar # Editor : Matius Celcius Sinaga # Author : # http://inventwithpython.com/hacking (BSD Licensed) ############################################################### import pyperclip pesan = 'Indonesia Raya' kunci = 9 mode = 'encrypt' HURUF ='A...
30745e993be6a17b2787fea32c68b0efa36a65c6
snp600/leetcode
/problems/69.py
325
3.625
4
from typing import List class Solution: def mySqrt(self, x: int) -> int: if x == 0: return 0 eps = 0.0001 a = 1 flag = False while True: b = (a + x // a) >> 1 if (a == b or b > a and flag == True): break flag = b < a a = b return a x = 0 print(Solution().mySqrt(...
8213f4d93efcde6e5255ef577a90970800ce920c
GabrielCardoso2019/Curso-de-Python
/Modulo01/Desafio006-Operadores-Aritmeticos.py
193
4.15625
4
num = int(input('Digite um número: ')) d = num * 2 t = num * 3 r = num ** (1/2) print('O dobro de {} é {}. O triplo de {} é {}. A Raiz quadrada de {} é {}'.format(num, d, num, t, num, r))
6616ff6504b59f141d4378007dbdc94f48caf052
GabrielCardoso2019/Curso-de-Python
/Modulo01/ex003-Soma.py
150
3.8125
4
n1 = int(input('Digite um valor: ')) n2 = int(input('Digite outro valor: ')) v = n1 + n2 print('A soma de {} e {} é igual a {}'.format(n1, n2, v))
3c7025bf94c2b89d88015d6c67ff3222918caa20
GabrielCardoso2019/Curso-de-Python
/Modulo01/Desafio009-Operador-Aritmetico.py
342
3.859375
4
num = int(input('Digite um número: ')) t1 = num * 1 t2 = num * 2 t3 = num * 3 t4 = num * 4 t5 = num * 5 t6 = num * 6 t7 = num * 7 t8 = num * 8 t9 = num * 9 t10 = num * 10 print('{:=^50}'.format(' Tabuada do {} ').format(num)) print(' {} \n {} \n {} \n {} \n {} \n {} \n {} \n {} \n {} \n {}'.format(t1, t2, t3, t4, t5, t...
75e43a0c546ea86e2cc72b8fd99dc7e19a65b9b0
GabrielCardoso2019/Curso-de-Python
/Modulo02/Desafio039-Condicoes-Aninhadas.py
826
4
4
from datetime import date from time import sleep print('-=-' * 20) print('Alistamento Militar') print('-=-' * 20) nome = str(input('Digite seu nome: ')) anoNascimento = int(input('Digite seu ano de nascimento: ')) idadeAtual = (date.today().year - anoNascimento) print() print('PROCESSANDO ANO...') sleep(3) print() ...
697fac346ebe811757a6aa0cb0970ca4b7e1e584
GabrielCardoso2019/Curso-de-Python
/Modulo02/Desafio043-Condicoes-Aninhadas.py
1,057
3.859375
4
print('-=-' * 20) print('Calculo de IMC') print('-=-' * 20) nome = str(input('Digite seu nome: ')) peso = float(input('Digite seu peso: Kg ')) altura = float(input('Digite a sua altura: ')) imc = (peso / (altura * altura)) cores = {'limpa': '\033[m', 'vermelho': '\033[1;31m', 'Verde': '\033[1;32m', ...
555fc140dbebe6b0ce2c47dd7ef516e712aa10dc
GabrielCardoso2019/Curso-de-Python
/Modulo03/Desafio081-Listas.py
494
4
4
valores = list() while True: valores.append(int(input('Digite um valor: '))) resp = ' ' while resp not in 'SN': resp = str(input('Quer continuar? [S/N] ')).strip()[0].upper() if resp == 'N': break if 5 in valores: temCinco = 'Tem o 5' else: temCinco = 'Não tem o 5' print('=-='...
853ba5fbacfd9cded11e3f5c1417c494648836b6
GabrielCardoso2019/Curso-de-Python
/Modulo02/Desafio066-Interropendo-Repeticoes-While.py
228
3.828125
4
cont = soma = 0 while True: num = int(input('Digite um número (999 pausa o programa): ')) if num == 999: break cont += 1 soma += num print(f'Você digitou {cont} valores e a soma dos valores é {soma}')