blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
b250ff1223b67e89d7ec160e270e069441f087b6
jokerKwu/BOJ_Algorithm
/introduction/BOJ_6376.py
471
3.8125
4
def fact(num): if num==1or num==0: return 1 else: return fact(num-1)*num print('n e') print('- -----------') for i in range(0,3): res=0 if i==2: for j in range(0, i + 1): res += float(1 / fact(j)) print(i,res) else: for j in range(0,i+1): ...
944634470e026720d6b3d237885de4d147008a7d
MiguelChichorro/PythonExercises
/World 3/Dictionary/ex093 - Soccer Player Record.py
1,387
3.625
4
from time import sleep colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: matches = list() player = dict() sumtotal = 0 ...
8761536451b37503346a6b2554589cd7a6732e78
MiguelChichorro/PythonExercises
/World 1/If...Else/ex031 - Cost of the trip.py
613
3.75
4
from time import sleep colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} trip = int(input("Enter your travel distance in km: ")) print("{}Loading...{}".forma...
a15ab7b014e73d7280d7cd6089aaba4e07701b3c
MiguelChichorro/PythonExercises
/World 2/If..elif/ex039 - Military Draft.py
2,318
3.984375
4
from datetime import date from time import sleep colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} gender = int(input("Before continuing the enlistment Enter...
a58d9898f16ffbc80673dad42d9410132d865a47
MiguelChichorro/PythonExercises
/World 1/First attempts/ex002 - Showing Name.py
354
3.609375
4
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} name = input('Enter your name: ') print('{}Nice to meet you, {}{}{}' .format(colors["blue"], colors["...
6d3436542b700463ab0d7ba5de4c4f21e918ab89
MiguelChichorro/PythonExercises
/World 3/Dictionary/ex094 - Uniting Dictionary and list.py
2,799
3.640625
4
from time import sleep from datetime import date colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: people = list() person = d...
f6ce9c4fe2aede9cf5a2c0aae33d84490ab1a150
MiguelChichorro/PythonExercises
/World 2/For/ex054 - Majority Group.py
694
3.859375
4
from datetime import date colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} today = date.today().year old = 0 new = 0 for c in range(1, 8): major = int(i...
e280976045fd51a9d1f53d85c00efb7708bfcccf
MiguelChichorro/PythonExercises
/World 3/Lists/ex078 - Bigger an Smaller on the list.py
1,070
3.796875
4
from time import sleep colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: values = list() for c in range(0, 5): values...
138eb99b9b21888e2d605b2ab7be3b3780a47943
MiguelChichorro/PythonExercises
/World 1/First attempts/ex003 - Adding Two Numbers.py
571
3.796875
4
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} n1 = int(input('Enter a number: ')) n2 = int(input('Enter a number: ')) sum = n1 + n2 print('Your first num...
bdabee3ae2e59c6a9ca0515762c777fecad1ec02
MiguelChichorro/PythonExercises
/World 3/Lists/ex079 - Unique values on the list.py
1,045
3.546875
4
from time import sleep colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: values = list() while True: print("if you wa...
0a044022798adb5d9be72d158e492cf64a60acb6
MiguelChichorro/PythonExercises
/World 3/Tuples/ex072 - Number Out.py
878
3.921875
4
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} num = ("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleve...
f3322cf13019262a2580f16fe0f9542691539a42
MiguelChichorro/PythonExercises
/World 3/Tuples/ex076 - Price List with Truple.py
1,237
3.921875
4
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} ans = 1 while ans == 1: tuple = () ans2 = 1 sum = 0 while ans2 == 1: produ = str(in...
2071d183d022624a62d55decd5567ece9a3af7c0
MiguelChichorro/PythonExercises
/World 2/For/ex050 - Even Sum.py
672
3.703125
4
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} sumc = 0 cont = 0 for c in range(1, 7): print("{}----- {} Number -----{}".format(colors["cian"], c, col...
e0d7d00c5c7c9c9f18fe6909e3128bed00c8e304
AkashMondal987/Project100
/bank.py
923
3.734375
4
class Atm: def __init__(self,cardNumber,pin): self.cardNumber = cardNumber self.pin = pin def checkBalance(self): print("Your Balance Is 10,000") def withdrawl(self,amount): newAmount = 10000 - amount print("You Have Withdrawhed: "+str(amount)+" Your ...
3a615108c97a54cceb7b8187aa0c23d26ef3ff18
Keonhong/IT_Education_Center
/Jumptopy/Jump_to_python/Chapter6/map2.py
329
3.921875
4
d1 = {1:'one', 2:'two', 3:'three'} def Add(a): return a + a def Mul(a): return a * a ret1 = list(map(Add, d1)) print(ret1) ret2 = list(map(Mul, d1)) print(ret2) ret1 = list(map(Add, [d1[i]for i in d1])) print(ret1) ret2 = list(map(Mul, [d1[i]for i in d1])) print(ret2) #문자열끼리 +는 되고, *는 안된다.
501a3c83cff32f3074b42e1f8096f9cf0ddc1544
Keonhong/IT_Education_Center
/Jumptopy/Data_science/CSV_test.py
1,137
3.609375
4
import csv with open('Demographic_Statistics_By_Zip_Code.csv',newline='')as infile: data = list(csv.reader(infile)) def get_csv_rowInstance(row_name): row_instance = [] row_index = data[0].index(row_name) for row in data[1:]: row_instance.append(int(row[row_index])) return row_instance de...
cdaba15e987b834f5d69679ab7fad4a84664fd9b
Keonhong/IT_Education_Center
/Jumptopy/Codding_dojang/namedtuple( ).py
1,732
3.75
4
# collections.nametuple()의 메소드들 # 1) _make(iterable) import collections # Person 객체 만들기 Person = collections.namedtuple("Person", 'name age gender') P1 = Person(name='Jhon', age=28, gender='남') P2 = Person(name='Sally', age=28, gender='여') # _make()를 이용하여 새로운 객체 생성 P3 = Person._make(['Peter', 24, '남']) P4 = Person....
49c5d4341dd270029b3931038c8ffe4b46c8b3ca
dineshd1998/python-assignment
/factorial.py
135
4.25
4
def factorial(a): if a==1: return 1 else: return a*factorial(a-1) b=factorial(3) print("Factorial of 3 is",b)
c49d3b7a67b467d9b39528c616e0c29391390a06
BenikaH/NHL_stats
/ReinforcementLearning/blackJack/blackjack_policy_solver.py
12,050
4
4
""" This module implements SIMULATION and SAMPLING methods for solving the optimal policy for playing blackjack. Simulation: The state-space is sampled by simulating different games situations and accumulating reward following different strategies (policy) Sampling: The state-space...
e2572da8bcaf1dc0489eb12a6c7a588d183bb3bb
BenikaH/NHL_stats
/ReinforcementLearning/nArmed_bandit/ANSON_multiarmed_bandit.py
5,277
3.8125
4
""" multiarmed_bandit.py (author: Anson Wong / git: ankonzoid) Classical epsilon-greedy agent solving the multi-armed bandit problem. Given a set of bandits with a probability distribution of success, we maximize our collection of rewards with an agent that explores with epsilon probability, and exploits...
ccdb6e2205b1c98e3131c6e9b389fda5c0cd9aca
diksha12p/DSA_Textbooks
/Chapter 2/SumLists.py
611
3.5
4
import math class ListNode: def __init__(self,x): self.val = x self.next = None class Solution: def addTwoNumbers(self,l1, l2): root = ans_ll = ListNode(-math.inf) carry, val = 0, 0 while l1 or l2 or carry: val1, val2 = 0, 0 if l1: ...
34c9fef6c63a0bca1885a32dc43d4e12d0adec14
diksha12p/DSA_Textbooks
/Chapter 2/Partition.py
751
3.671875
4
import math class Node: def __init__(self, val): self.value = val self.next = None class LinkedList: def __init__(self): self.head = None def push(self, new_val): new_node = Node(new_val) new_node.next = self.head self.head = new_node class Solution: ...
3add715e7ec491c2b16bca54448fa5aa5ff80e56
diksha12p/DSA_Textbooks
/Chapter1/PalindromePermutation.py
989
3.8125
4
from collections import Counter # Using inbuilt Counter() method def palindrome_permutation(s): d = Counter(s.lower().replace(" ","")) count = 0 for value in d.values(): if value % 2: count += 1 return count <= 1 # Without using inbuilt Counter() method # Without using lower() and replace()...
935884e2264b4dc42e9582fdbea52b4189de634b
diksha12p/DSA_Textbooks
/Chapter1/IsUnique.py
322
4.0625
4
def is_unique(str): if len(str) > 128: # Assuming ASCII character set return False is_unique_list = list() for char in str: if char in is_unique_list: return False else: is_unique_list.append(char) return True string = "dikshaa" print(is_unique(string))...
3e12a5468443748b0ab61c3af2e106fc2d561112
diksha12p/DSA_Textbooks
/Chapter1/OneIsPermutationOfOther.py
553
3.859375
4
def check_permutation_symetric(str1, str2): # Type of string? ASCII / Unicode? Assume, ASCII. # Thus, character set length = 128 if len(str1) != len(str2): return False char_count = [0] * 128 for char in str1: char_count[ord(char)] += 1 for char in str2: char_count[ord...
9f68e7fd902b128ddb5a25df19964eec6f775f9f
diksha12p/DSA_Textbooks
/Chapter3/AnimalShelter.py
2,321
3.6875
4
class Animal(object): def __init__(self, name=None, type=None): self.name = name self.type = type self.timestamp = 0 self.next = None class AnimalShelter(object): def __init__(self): self.cat_head = None self.cat_tail = None self.dog_head = None ...
84d6bfe4e4fe89f4a08d2e8ca73631d950c86fcf
KarthickM89/basicPython
/loops.py
236
4.28125
4
#for i in [0, 1, 2, 3, 4, 5]: # print(i) #for i in range(6): # print(i) # Defining names names = ["karthick", "kaviya", "kavinilaa"] name1 = "kannan" # Looping and Printing for name in names: print(name) for n in name1: print(n)
083ecb47745d21c03137430c25b4be5341685e9b
TaiPhillips/concurrency-in-python-with-asyncio
/chapter_08/listing_8_3.py
863
3.515625
4
import asyncio from asyncio import StreamReader from typing import AsyncGenerator async def read_until_empty(stream_reader: StreamReader) -> AsyncGenerator[str, None]: while response := await stream_reader.readline(): #A yield response.decode() async def main(): host: str = 'www.example.com' req...
3d3b20035e27eb4889b83004bc3e638005e371d4
PazBruna/Python_POO
/herancaMultipla.py
1,107
3.734375
4
class Funcionario: def __init__(self, nome): self.nome = nome def registra_hora(self, horas): print('Horas registradas...') def mostrar_tarefas(self): print('Fez muita coisa..') class Caelum(Funcionario): def mostrar_tarefas(self): print('Fez muita coisa, C...
386dc342370fed024bcf3641747c7a398bef37da
simonecorbo99/Hacktoberfest-2020-LeetCode-Problems
/problems/nehalabhasetwar-RemoveKdigits-python.py
1,820
3.765625
4
''' * Solution to Remove K Digits at LeetCode in Python * * author: Neha Labhasetwar * ref: https://leetcode.com/problems/remove-k-digits/ ''' '''PROBLEM: Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. EXPLANATION:- Suppose...
82c3c88acbdead18b0c8e96111b413d2508251ee
zdimon/wezom-python-course
/students/Kolya/hometask/shah.py
1,218
3.5
4
import random cards = [2,3,4,5,6,7,8,9,10] coloda = [] vzyal = [] chisla = 0 def it(): while True: i = random.randint(0, 35) if i not in vzyal: break vzyal.append(i) else: continue return i for row in cards: for r in range(4): coloda.append(row) random.shuffle(coloda) for row in range(2): i = rando...
c8efb09db7c8fccd725e0004fe16b74ea22030c9
mingzidouzhemenanqi/Getting-started-with-python-code
/Files from MOOC/Python实例/第一期MOOC实例/实例十三:体育竞技模拟/体育竞技模拟.py
1,294
3.640625
4
#体育竞技分析: import random as r def monibisai(an,bn,n): aj,bj=0,0 for i in range(n): jieguo=danju(an,bn,i) if jieguo=='a': aj+=1 else: bj+=1 return aj,bj def danju(an,bn,n): af,bf=0,0 #qiu=faqiu(n) qiu='A' while (af<=15 and bf<=...
ec0df6caf03f776cc37829b1ee29fafabbc560de
mingzidouzhemenanqi/Getting-started-with-python-code
/Files from MOOC/Python实例/第一期MOOC实例/实例四:简易文本进度条/简易进度条模拟.py
198
3.578125
4
#简易文本进度条模拟 import time as t jindu=10 for i in range(jindu+1): a=i*'*' b=(jindu-i)*'.' c=i*10 print("{:^3.0f}%[{}->{}]".format(c,a,b)) t.sleep(2)
2d62805a6c3d2b0c044e0848e150e58e0a16beae
dfialho/pico-adapters
/adapters/configs/base.py
1,912
3.828125
4
from logger import Logging class LoadError(Exception): """ Raised when an error occurs while loading the config file. """ class BaseConfiguration: """ Abstracts the access to the configuration file. This is the base class to access configuration files. It accepts any parameter key and value. The...
cfa1923fa38c9bd1653164e5989698e03748dfe5
zebleck/SheetDownloader
/inputter.py
2,308
3.59375
4
import tkinter as tk from tkinter import filedialog import getpass import os.path class Inputter: def GetInput(self): root = tk.Tk() root.withdraw() name = input("Dein Name: ") if not(os.path.isfile(name + ".txt")): self.Setup(name) return name def...
6b5045fe8bd561467f4412a5c4bb7063bef7349e
zhouyuq6/CSC180-190-Labs
/CSC180/lab3/redfibo.py
311
3.609375
4
def fibo(n): if n==0: return 1 elif n==1: return 1 else: return fibo(n-1)+fibo(n-2) def fiboL(n): fibol=[] for i in range(0,n+1): fibol=fibol+[fibo(i)] return fibol def redfibo(n): Fibol=list(fiboL(n)) def reducingMulti(a,b): return a*b redFibo=reduce(reducingMulti,Fibol) return redFibo
789a38742b091176b8c9a16d80f84d1810fb02f0
joshuasturre/TryPy
/montyhallsim.py
446
3.546875
4
from random import randint import time while True: x = 0 y = int(input('How many array\'s would you like created?')) while x < y: myList = [0, 0, 0] toChange = randint(0, 2) if toChange == 0: myList[0] = 1 if toChange == 1: myList[1] = 1 if toC...
96b4061196c3dc36646c9f3b88a004890db47edf
KostaSav/Tic-Tac-Toe
/console.py
1,231
4.1875
4
########## Imports ########## import config # Initialize the Game Board and print it in console board = [ [" ", "|", " ", "|", " "], ["-", "+", "-", "+", "-"], [" ", "|", " ", "|", " "], ["-", "+", "-", "+", "-"], [" ", "|", " ", "|", " "], ] ## Print the Game Board in console def print_board(): ...
80e4683b931fc26be362d562862bedd83d78fead
Studia-AMW/oor
/Lab_2 - procesy/Lab2 - kolejka procesów.py
1,769
3.515625
4
# -*- coding: utf-8 -*- import time import multiprocessing def ciąg_fibannaciego(n): if n < 0: # nie można obliczyć ciągu Fibannaciego dla liczb ujemnych raise ValueError if n < 2: return n return ciąg_fibannaciego(n-1)+ciąg_fibannaciego(n-2) #rekurencyjne wywołanie funkcji def f...
c03e3f76b690c87b8939f726faeac5c0d6107b93
Anwar91-TechKnow/PythonPratice-Set2
/Swipe two numbers.py
1,648
4.4375
4
# ANWAR SHAIKH # Python program set2/001 # Title: Swipe two Numbers '''This is python progaramm where i am doing swapping of two number using two approches. 1. with hardcorded values 2. Values taken from user also in this i have added how to use temporary variable as well as without ...
e61a0695fa87299f9263befc6aa54c304991d020
NVillafane05/ronronear-paradigmas
/tp integrador/main.py
993
3.90625
4
from Tweet import * from Ronronear import * class Main(): ronronear = Ronronear() usuario = "@"+input("Ingrese su usuario: ") print("Bienvenido/a "+usuario+"\n") while (True): try: op = int(input("1. Add tweet\n2. Cambiar de usuario\n3. Ver usuarios - tweets\n4. Salir\n")) if(op==4): break els...
f64823d386ece3c87d07b7d1d5b0f10fef136df3
Umbreon19/PythonHw
/chatbot.py
329
3.828125
4
def introuduction(): Name=input('What is your Name') print('How are you doing?,'+Name+'') Candy=input('What Candy do you like?') print('Nice! I like '+Candy+' too!') Cheese=input('What kind of Cheese do you like best?') print('I could eat '+Cheese+' all the time!') print('sorry I have to go ...
4fe6d681d8f6fb36a4e6feddbc89f3921e155ea3
ArseniyKichkin/2021_Kichkin_infa
/exercise_12.py
311
3.5
4
import turtle turtle.speed(0) turtle.shape('turtle') turtle.left(90) i = 0 while i < 4: n = 0 while n < 180: turtle.forward(1) turtle.right(1) n = n + 1 n = 1 while n < 180: turtle.forward(0.15) turtle.right(1) n = n + 1 i = i + 1 input()
0acb335f3eeb203429541747b2c86d89dab378c0
ArseniyKichkin/2021_Kichkin_infa
/exercise_6.py
259
4
4
import turtle as t n = int(input('Введите количество лап' + '\n')) t.shape("turtle") t.color("blue") t.width(2) for i in range(n): t.forward(80) t.stamp() t.backward(80) t.left(180) t.left(180 * (n - 2) // n) input()
21a3132034b1fc55a409efc63222da273727a919
jven2/advocatia
/ml.py
5,751
3.53125
4
import numpy as np import pandas as pd import pickle from sklearn.neighbors import KNeighborsClassifier from sklearn.neighbors import KNeighborsRegressor from sklearn import preprocessing """ load_data(adv_data_name, county_level_name) Loads the provided filenames into pandas dataframes, then returns the dataframe...
601d9595f5f555b81b740c3d47ffa9c187ccdc2f
jonalynnA-cs29/cs-module-project-algorithms
/rock_paper_scissors/rps.py
1,083
3.859375
4
#!/usr/bin/python import sys import random def rock_paper_scissors(n): global all_combinations all_combinations = [] move_options = ['rock', 'paper', 'scissors'] def build_moves(countdown, piece_being_built): if countdown == 0: all_combinations.append(piece_being_built) ...
4d3b2db61b80cb7b0027a4fda67a878050b132dc
LandersAtLambda/Sprint-Challenge--Data-Structures-Python
/ring_buffer/ring_buffer.py
863
3.5
4
class RingBuffer: def __init__(self, capacity): self.capacity = capacity self.current = 0 self.storage = [None]*capacity def append(self, item): self.storage[self.current] = item if self.current == len(self.storage)-1: self.current = 0 else: ...
ee94ba8cde5e3529ce36f88a4be45dacf89805f8
MonikaJayakumar-nj/TICTACTOE
/main.py
3,779
4.0625
4
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name}') # Press ⌘F8 to togg...
af8cae1d855a8cb9d4edd5196658cf448dc96da0
kuronori/self_taught
/ch22
1,919
3.796875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 4 12:40:06 2020 @author: TakahiroKurokawa """ #FizzBuzz def FizzBuzz(): for i in range(1,101): if (i%3==0) & (i%5==0): print("FizzBuzz") elif i%3==0: print("Fizz") elif i%5==0: print("...
ae521e01fed4ce8af959aed4797403e0e72b57b1
kuronori/self_taught
/ch14
909
4.0625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 2 14:49:56 2020 @author: TakahiroKurokawa """ class Shape: def __init__(self): pass def what_am_i(self): return "I am a shape" class Square(Shape): square_list=[] def __init__(self,l): self.name="Square" ...
e180bf719676bc8d11fd7c0c26096f59a9752f00
abankalarm/Data-structures-in-cplusplus
/array/1 unsorted array.py
210
3.609375
4
def findelement(arr, n,key): for i in range (n): if (arr[i])==key: return i+1 else: continue arr = [1,2,4,2,3,1,5,6,3,1] n = len(arr) print(findelement(arr, n , 5))
e1c4f9c2034a1fa3f8f4535e68f394af0e6f2d7d
paulo-sk/python-crash-course-2019
/c6_dictionaries/loop_dictionaries.py
943
4.3125
4
""" vc pode dar loop em dicionarios de 3 formas: loop nas keys: loop nos values: loop nos key , values: """ favorite_languages = { 'jen': 'python', 'sarah': 'c', 'edward': 'ruby', 'phil': 'python', } # loop nas keys; for name in favorite_languages.keys(): print(name.title()) # l...
a5dcfbb508c112b3184f4c65c0425573b4c2c043
paulo-sk/python-crash-course-2019
/c10_files_and_exceptions/exceptions/division_calculator.py
805
4.28125
4
# programa tenta fazer o que vc quer, se nao de, ele manda uma mensagem de erro mais amigavel # e o programa continua rodando try: print(5/0) except ZeroDivisionError: print("You can't divide by zero.") print("\n-------------------------------------------------------") # outro exemplo print("\nGive me 2 numb...
ba97749fa33b5684395bb4be576c96ea0760725e
paulo-sk/python-crash-course-2019
/c8_funcoes/passando_lista.py
1,367
3.546875
4
def greet_users(names): for name in names: msg = f"hello {name.title()}, you wellcome" print(msg) user_names = ['apk','shiit','crep','big mak'] greet_users(user_names) # mdelos de pintura modelos_nao_finalizados = ['a','b','c','d','e'] modelos_finalizados = [] while modelos_nao_finalizados: m...
0ecf99a10390cf56feed039f8d0c55ed502d66ef
paulo-sk/python-crash-course-2019
/c9_classes/try_it_yourself/4_number_serverd.py
1,173
3.921875
4
class Restaurant: def __init__(self,restaurant_name,cuisine_type): self.name = restaurant_name self.cuisine = cuisine_type self.number_served = 0 def describe_restaurant(self): print(f"Restaurant name: {self.name}") print(f"Restaurant cuisine type: {self.cuisine}") ...
533f6cf00c60770635346c9ab60eb3100c8cbfcd
michal12334/python-snake
/main.py
1,180
3.515625
4
import pygame from window import * from snake import * from apple import * pygame.font.init() def showYouLost(window): font = pygame.font.SysFont("comicsans", 60) text = font.render("You lost", 1, (255, 255, 255)) window.blit(text, (420, 200)) def main(): window = Window(900, 900) w...
cf641a406a6d1cbca03458e55b32d8d64b3a523f
adityad30/Strings-2
/97FindAnagrams.py
1,434
3.5625
4
""" // Time Complexity :T = O(M) + O(N) // Space Complexity :O(n) // Did this code successfully run on Leetcode : YES // Any problem you faced while coding this : NA add all the pattern characters in hashmap with default value 1 in character -> reduce its count in hashmap; if the cout is 0, incr...
591983d40b7c967e5173cc5cff2693d2bd61d397
icofalc/critto-scripts
/modulo.py
272
4
4
def modulo(numero,modulo): risultato = numero % modulo return risultato while 1: num=input("dammi il numero :") num=int(num) mod=input("dammi il modulo :") mod=int(mod) ris=modulo(num,mod) print("viene "+str(ris))
9c49ab889ce786a73f22841b04941d53cd76db22
OpenSource-Programming/PythonTraining012021
/melanierosson_py_regex_012721.py
1,119
3.921875
4
# importing re import re # opening file filename = 'regex_sum_1136998.txt' filetxt = open(filename) # declarations regex = '[0-9]+' sumInts = 0 countInts = 0 integers = [] newIntList = [] newIntItemStr = '' # stripping whitespace and finding integers in each line of the file for line in filetxt : line = line.rst...
8aebc7b45a1bb15fff8574d8cc5c8efc9c099480
OpenSource-Programming/PythonTraining012021
/Mo/RegularExpressions/mopen_py_readdnumbers_012021.py
579
4
4
# Exercise 2: Write a program to look for lines of the form # `New Revision: 39772` # and 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. # Enter file:mbox.txt # 38549.7949721 # Enter file:mbox-short.txt # 3...
fa2ab66b00fc188f974de5ea62a24580f6dda2ae
OpenSource-Programming/PythonTraining012021
/frank-quoc_py_dictionaries_012021.py
509
3.84375
4
# Excercise 9.4 name = input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) email_count = {} for line in handle: line = line.rstrip() words = line.split() if len(words) == 0: continue if words[0] == "From": email_count[words[1]] = email_count.get(words[1...
33773ca76cae7fa478321fe358def9e371735fae
OpenSource-Programming/PythonTraining012021
/frank-quoc_py_functions_012021.py
405
3.96875
4
# Exercise 4.6 def computepay(hours, rate): # print("In computepay", hours, rate) pay = hrs * rate if hours > 40: overtime = (hours - 40.0) * (0.5 * rate) pay += overtime # print("Returning", pay) return pay if __name__ == '__main__': hrs = float(input("Enter Hours: ")) rat...
ba954b359c6eb00aa1dfef5ca761ca3bbd4fe8b2
ajay09/CodingPractice
/DailyCodingProblem/solutions_py/problem_002.py
647
3.765625
4
def productExceptSelf(nums): numsLength = len(nums) leftProducts, rightProducts = [0]*numsLength, [0]*numsLength leftProducts[0] = 1 for i in range(1, numsLength): leftProducts[i] = nums[i-1] * leftProducts[i-1] # print(leftProducts) rightProducts[numsLength - 1] = 1 for i in r...
358484bb7344afc9513a9173bf58a299edc785fb
gohjungho/JavaBasic
/everyone Java/Conditional_Operator.py
468
3.671875
4
# 삼항연산자를 사용하여 (if 사용 금지) # 1이면 1st, 2이면 2nd, 3이면 3rd, 4이면 4th # 를 출력하는 프로그램을 작성하시오. ord = int(input("숫자 입력: ")) crd = ( (str(ord) + "st") if (abs(ord) % 10 == 1 and abs(ord) % 100 != 11) else (str(ord) + "nd") if (abs(ord) % 10 == 2 and abs(ord) % 100 != 12) else (str(ord) + "rd") if (abs(ord) % 10 == 3...
0ebe2bc15f1a1dc56ccd08b7929c4703ed5fa43d
blorp77/euler
/15.py
217
3.828125
4
def lattice(n): a = [] for i in range(n+1): b = [] for j in range(n+1): if i == 0 or j == 0 : b.append(1) else: b.append(a[i-1][j] + b[-1]) a.append(b) return a print lattice(20)[-1][-1]
90dd0b20355175cb4b8edfcd95f10c6c36c3d080
blorp77/euler
/6.py
181
3.859375
4
def sum_of_square(n): total = 0 for i in range(n+1): total += (i**2) return total def square_of_sum(n): return (n*(n+1)/2)**2 print square_of_sum(100) - sum_of_square(100)
245c2c588ac9c0b98e1d95a382091d65267eff94
blorp77/euler
/1.py
62
3.75
4
a=0 for i in range(1000): if i%3==0 or i%5==0: a+=i print a
a42c623f85185a96f21af3f780fb1e229679d126
deltonmyalil/HeartDiseasePrediction
/HeartDiseasePrediction/HeartDiseasePrediction.py
14,014
3.59375
4
# Heart attack for dummies # https://www.kaggle.com/ronitf/heart-disease-uci ''' Creators of the Dataset: 1. Hungarian Institute of Cardiology. Budapest: Andras Janosi, M.D. 2. University Hospital, Zurich, Switzerland: William Steinbrunn, M.D. 3. University Hospital, Basel, Switzerland: Matthias Pfisterer, M.D. 4. ...
c60b92f07a23bac432242e35441cfcdad2d6dfb5
KavinSelvarasu/Python_Beginer_projects
/dies_rolling.py
356
3.953125
4
# importing random number generator import random play = input('would you like to roll dies: ').strip().lower() if play == 'yes': rolls = int(input("Enter number of dies to roll: ")) def diesRoll(rolls): for i in range(0, rolls): dies = random.randint(1, 6) print(dies) ...
87d19ef751bdb5bd5e305d8a18c634ebf08c39a8
VladSquared/SoftUni---Programming-Basics-with-Python
/01. Problem.py
805
4.125
4
email = input() while True: cmd = input() if cmd == "Complete": break elif "Make Upper" in cmd: email = email.upper() print(email) elif "Make Lower" in cmd: email = email.lower() print(email) elif "GetDomain" in cmd: count = int(cmd.split...
8ae6cf66956ff74fc103584e9f9b4c94ec6653ef
Jacob-Bordelon/CSC_442
/Timelock/Timelock/timelock.py
4,632
3.734375
4
# File: timelock.py # Team: Johnmichael Book, Jacob Bordelon, Tyler Nelson, # Logan Simmons, Eboni Williams, Breno Yamada Riquieri # Version: 10.13.19 # Usage: Use python 2.7 # Example: python timelock.py < epoch.txt # Github: https://github.com/Jacob-Bordelon/CSC_442.git # Desc...
3b59d43556d9a314b59c67defc25d860bab7eb60
Jacob-Bordelon/CSC_442
/CYBERSTORM/XOR/xor.py
2,471
3.609375
4
# File: xor.py # Team: Johnmichael Book, Jacob Bordelon, Tyler Nelson, # Logan Simmons, Eboni Williams, Breno Yamada Riquieri # Version: 10.12.19 # Usage: Use python 2.7 # Example: python xor.py < ciphertext # python xor.py < plaintext > ciphertext # Github: ...
c8e0402ed35781a249c86874ecb7072a74a0b608
vivekc/python_excercises
/focusvision/focusvision_interview_question_1.py
340
3.84375
4
""" What would be the output """ def f(chars): for c in chars: yield c for elt in f(chars): for c in chars: yield elt + c g = f('cat') print g.next() # 'c' print g.next() # 'cc' print g.next() # 'ca' print g.next() # 'ct' print g.next() # print g.next() print g.next() print g.ne...
bc0dcbab4f7dd94e98c2591fe4f684b164a40ec0
sonamrana2908/pythonprograms
/DiceRolling.py
402
3.765625
4
# coding: utf-8 # In[2]: # Dice Rolling Simulator : https://knightlab.northwestern.edu/2014/06/05/five-mini-programming-projects-for-the-python-beginner/ import random RollDice=input('Do you want to roll the dice:') RollDice = RollDice.upper() while(RollDice == 'YES'): print(random.randint(1,6)) RollDice=in...
c51b19cb920cd158bcc88b19b74f57690a243ff8
ganpatagarwal/python-scripts
/test/string_sort.py
516
3.5
4
a = "heblloza" l1= [] l2= [] for i in range(0,len(a)): l1.append(a[i]) while(l1): print l1 min_val = l1[0] for j in range(0,len(l1)): if l1[j] < min_val: min_val = l1[j] print min_val l2.append(min_val) l1.remove(min_val) print ''.join(l2) def sorastring(strr): strr = [strr] print 'first',strr de...
297bb287787a7389fe6b765c3dd37fb6d65a31fe
ganpatagarwal/python-scripts
/memo_fib.py
708
3.546875
4
import functools def memoize(func): cache = func.cache = {} @functools.wraps(func) def memoized_func(*args, **kwargs): key = str(args) + str(kwargs) print key print cache if key not in cache: cache[key] = func(*args, **kwargs) return cache[key] return...
cb49784d1f95205fb3152e9e3ff05f2bc585ff17
rakeshsingh/my-euler
/euler/utils.py
1,623
4.25
4
#!/usr/bin/python import math from math import gcd def my_gcd(a, b): ''' returns: str gcd for two given numbers ''' if a == b or b == 0: return a elif a > b: return gcd(a-b, b) else: return gcd(b-a, a) def lcm(a, b): '''''' return a * b // gcd(a, b) def ...
6992125aaa69d5f6163a13d434807f1239618acc
rakeshsingh/my-euler
/003_largest_prime_factor.py
514
3.875
4
#!/usr/bin/python from myutil import is_prime, get_next_prime def largest_prime_factor(n): if n <= 2: raise(RuntimeError('number should be greater than 2')) else: factor = get_next_prime(1) while True: if is_prime(n): return (n) if n % factor == ...
f2cf792150bca055c71b45ee8e46f08b3b45ee8b
Kalunge/python_challenges
/new.py
18,879
4.46875
4
# TASK 1 # Write a program which accepts a string as input to print "Yes" if the string is "yes", "YES" or "Yes", otherwise print "No". # Hint: Use input () to get the persons input # TASK2 # Implement a function that takes as input three variables, # and returns the largest of the three. Do this # without using t...
e29926d522ce32f376f349263cae0043ae37885c
fredmeews/adventofcode
/2020/19/bin.py
241
3.59375
4
with open('testinputMatches2-bin.txt') as f: for line in f.readlines(): line = line.strip() if line and not line[0] == "#": print("{} ==> {}".format(line, int(line, 2))) else: print(line)
4461774ea09b7a388f925fb65395c288cadd70e4
CourchesneA/ProjectEuler
/Euler17.py
2,183
3.765625
4
import sys import math sys.setrecursionlimit(1200) def test(x): print("test function") return def printNumbers(num): if (num == 0 ): return 0 #Base case if (num == 1000): print("onethousand "+str(len("onethousand"))) return len("onethousand")+printNumbers(num-1) hundred =...
17623ff0c97ec66377b72c821874dee2ac15ff1d
xxiang13/python
/stack_reverse_char_in_string.py
587
3.875
4
# -*- coding: utf-8 -*- """ Created on Wed Apr 13 @author: Xiang Li IDE: Spyder Python 3.4 """ from data_structures import Stack def revstring(mystr): """ :type mystr: string :rtype: string use Stack Last In First Out feature to reverse a string """ aStack = Stack() for i in list(mys...
b7f3c312114f3068500221b4b93ef03166717394
xxiang13/python
/find_alphabet_sub.py
1,079
3.546875
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 28 14:04:06 2015 @author: Shawn Li IDE: Spyder python 3.4 """ def findAlphabetSub(s): '''Find longest alphabet substrings Argus: String: string with all lower cases Return: String: substring ''' charList = list(s) alphab...
860788ccf0cfc0a5a878822fbf5f3e0a28abb8d2
JamesHullCS/CodeWars-Solutions
/CodeWars/Python/Hex to Decimal.py
187
3.5
4
# https://www.codewars.com/kata/57a4d500e298a7952100035d/train/python # Original Solution def hex_to_dec(s): # we use 16 as it's the base for hex as a base return int(s, 16)
0aa9f9f1e42b930b26c9cc96dad4d954c35ebe0b
zhipingx/EECS349_MachineLearning
/hw4_collaborative filtering_&_params_experiment/item_cf.py
2,726
3.5625
4
Starter code for item-based collaborative filtering # Complete the function item_based_cf below. Do not change its name, arguments and return variables. # Do not change main() function, # import modules you need here. import sys import numpy as np from loader import * from helper import * def item_based_cf(datafile, ...
be54e71d297bcc85988b424e62e329f24d8f4583
boonth/scripts
/image_diff.py
1,961
3.90625
4
# compare two images. create a third image showing the difference between the # two. in the diff image, black pixels means same color, and white pixels means # different colors. can also optionally output a text file listing all the # different pixels. import Image import sys def diff(input1, input2, output, output...
cebc454080deeafa8b8de23dbcab5c3e7e24526d
iosifsag/python2016
/square .py
200
3.703125
4
x=input("give a number: ") if(x<=0): print "wrong data" elif (x**0.5 % 1 == 0) : akeraios =True else: akeraios = False print akeraios
843b72befb84665342193505b511a3faeef04588
jnguyen1192/advent_of_code
/2018/Day 14/Part two/TestDay14part2.py
5,208
3.71875
4
import unittest def input_file(): # return the input_test file in a text file = open('input', 'r') lines = [line.rstrip('\n') for line in file] file.close() return lines def output_file(): # read line of output_1 file file = open('output', 'r') res = file.read() file.close() ...
fb203e55e8653490e4919d883f688fadb1572436
jnguyen1192/advent_of_code
/2020/Day 12/Test.py
7,861
4.03125
4
import unittest def input_file(suffix): file = open('input_' + suffix, 'r') lines = [line.rstrip('\n') for line in file] file.close() return lines def output_file(number): file = open('output_'+str(number), 'r') res = [line.rstrip('\n') for line in file] file.close() return res def...
971094a287ae7f104e4a373bbfd30f42d3fcb277
jnguyen1192/advent_of_code
/2020/Day 1/Day 1 -/TestDay1part1.py
1,570
3.703125
4
import unittest from collections import Counter def input_file(): file = open('input', 'r') lines = [line.rstrip('\n') for line in file] file.close() return lines def output_file(): file = open('output', 'r') res = [line.rstrip('\n') for line in file] file.close() return res def fi...
c1bf2014cb245ec29b50901423e55d98dc9540d0
moose-pop/learning
/courses/wireless_communication/3-8.py
567
3.53125
4
from math import exp import numpy as np from scipy.special import j0 def p_z(z): """PDF of Rician fading distribution""" return exp(-1-(z**2)*10**8)*j0(2*z*10**4)*z def cdf_rician(lower, upper, step): """Approximate CDF of Rician fading distribution""" interval = int((upper-lower)/step) result = 0...
9973b5bf601e78dc64fe18f225478fb2da2c51d9
samuelcm/estrutura_lista
/idade_altura.py
988
4.03125
4
#Faça um Programa que peça a idade e a altura de 5 pessoas, #armazene cada informação no seu respectivo vetor. Imprima a idade e #a altura na ordem inversa a da ordem lida. pessoa1_id = int(input("Qual a idade?\n")) pessoa1_alt = float(input("Qual a altura?\n")) pessoa1 = [pessoa1_id, pessoa1_alt] pessoa2_id = int(i...
45aaab06a70161e300a77aad17ad3a1f58e54228
skounah/etsinf3
/SAR/Lab3/SAR_p3_monkey_evolved.py
1,093
3.6875
4
#! -*- encoding: utf8 -*- # inspired by Lluís Ulzurrun and Víctor Grau work """ 3-. El Mono Infinito, parte 2: generador de frases Alemany Ibor, Sergio Galindo Jiménez, Carlos Santiago """ import sys import pickle import random def load_object(file_name): with open(file_name, 'rb') as fh: obj = pickle.l...
b570662e20ed9130b2d6eb5507fb2afdcef4477b
sulemanmahmoodsparta/Data24Repo
/ControlFlows/WhileLoops.py
534
3.859375
4
# x = 0 # # while x < 10: # print(f"it's working --> {x}") # if x == 4: # break # x += 1 # print("What is your age?") # age = input() # # while age.isnumeric() == False: # print("Please reenter your age as a number") # # else: # print(f"Your age is {age}") user_prompt = True while user_pr...
e989154ef97031eca99db043575b6c26c8e61903
sulemanmahmoodsparta/Data24Repo
/Variables/main.py
303
4.09375
4
# a = 1 # b = 6 # c = 3.5 # hi = "Hello World!" #print(hi) # print(type(hi)) ---- Allows for printing the type for the function. print("What is your name?") name = input() print("Hi") print(name) print("What is your DOB?") DOB = input() print("Wow you are born on the,") print(DOB) print(type(DOB))
e8eb1ee408ddcc96e83ceef3e62b6e636479c2b7
sulemanmahmoodsparta/Data24Repo
/Football_Game/a_Players.py
2,812
3.9375
4
import random # for player generation from abc import ABC, abstractmethod PlayerPositions = ["Goalkeeper", "Defender", "Midfielder", "Attacker"] # An Abstract class that cannot be initialised class Players(ABC): @abstractmethod def __init__(self, fname, lname, value, position, score): self.id = 0 ...
d1c235ff99255777046a7a5f732d8c7fb2a6e80d
sulemanmahmoodsparta/Data24Repo
/WorkingwithFiles/WritingToFile.py
255
3.890625
4
def write_to_file(file, order_item): try: with open(file, "w") as file: file.write(order_item + "\n") except FileNotFoundError: print(f"The file {file} does not exist!") write_to_file("writing_orders.txt", "banana")
429dbe436598424878afa1aeee7f5238e2682c57
sulemanmahmoodsparta/Data24Repo
/Football_Game/Match.py
1,093
3.71875
4
from s_Teams import Teams import random class Match: def __init__(self, team1: Teams, team2: Teams): self.team1 = team1 self.team2 = team2 self.winner = None # determined after play_match is called def play_match(self): # Determine which teams wins the match. Team 2 is favour...
618fb72bdf38974b157f55bee8eb86f8bae31e93
sulemanmahmoodsparta/Data24Repo
/Databall/a_Players.py
1,514
3.859375
4
import random # for player generation from abc import ABC, abstractmethod # An Abstract class that cannot be initialised class Players(ABC): @abstractmethod def __init__(self, fname, lname, value, position, score): self.__first_name = fname self.__last_name = lname self.__value = value ...
858031d131f1ba4ce058049f447bc469af31aec6
adkhune/aditya-codes
/pythonscripts/Regular Expressions/regEx3.py
438
3.703125
4
# digit string manipulation example # 122399404427 if this is input then output #12399404427 12239404427 12239940427 # and give me the largest number import re from collections import Counter def main(): str = '1223999404427' print("you gave me", str) numRegex = re.compile(r'(\d)\1*') num = ...