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
da908f4f0dc1ba4da105d176bbb4a2a7c5573f63
Prostotakvishlo/Test
/88887.py
345
3.765625
4
import turtle turtle.shape('turtle') def koch(order, size): if order == 0: turtle.forward(size) else: koch(order-1, size/3) turtle.left(60) koch(order-1, size/3) turtle.right(120) koch(order-1, size/3) turtle.left(60) koch(order-1, size/3) koch(4...
4407e6b40cda3682f22eb67af702491999031c5f
lxy-kyb/algorithm_python
/AlgorithmPython/AlgorithmPython/Data Structure/BinarySearchTree.py
4,257
3.96875
4
class TreeNode: def __init__(self, data, left, right, parent): self.data = data self.left = left self.right = right self.parent = parent class BinarySearchTree: def __init__(self): self.root = None def preOrder(self, node): if node is not None: ...
932fe11333cd1b1b7fb1c4d0f91c58acd8d5f411
DyllanSowersTR/IT310
/Project 1/partA.py
1,745
4.0625
4
import random #Got some help from StackOverflow, but created it into my own code with additional code for personal touch as well. #https://stackoverflow.com/questions/46709794/birthday-paradox-python-incorrect-probability-output #Definition for the birthday paradox listing def BirthdayParadox(): #Create empty l...
1fcc669c4573304e3921c6ae00882d67c6d96ffd
jgk0/Python-challenges
/lab10/lab10.py
2,729
3.625
4
################################################### # MC102 - Algoritmos e Programação de Computadores # Laboratório 10 - Caça-Palavras 2.0 # Nome: # RA: ################################################### """ Esta função recebe como parâmetro uma matriz, uma posição inicial na matriz determinada pelos parâ...
5ba26eceae96d3a35524201f09891f33f2383e12
CookyChou/leetcode
/first/play4.py
328
4
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/4/4 16:38 # @Author : bgzhou class Solution: def rotate(self, nums, k: int) -> None: nums[:] = nums[-(k % len(nums)):] + nums[:-(k % len(nums))] if __name__ == '__main__': s = Solution() list1 = [1, 2] s.rotate(list1, 3) prin...
bc41105ba3c2686bd58918af46665276103dff2c
RobyOneCenobi/The-Turtle-fun
/fabric.py
1,559
3.984375
4
import turtle import random """ ustawienia początkowe i rysowanie ramki """ pen = turtle.Turtle() pen.pensize(1) pen.pencolor('blue') pen.penup() pen.goto(-220, 220) pen.pendown() pen.forward(400) pen.right(90) pen.forward(400) pen.right(90) pen.forward(400) pen.right(90) pen.forward(400) pen.penup() pen.goto(-200, 20...
44471df9935c1a87147214d0650e534373ed391d
arun-me/copy
/100DaysOfPython/test_bmi.py
424
4.375
4
#bmi calculator height = float(input('enter your height (cms)\n')) weight = float( input('enter your weight (kg)\n')) bmi = round(weight/(height/100)**2,2) if bmi < 18.5: bmi_type="Under Weight" elif bmi < 25 : bmi_type="Normal" elif bmi < 30 : bmi_type="Over Weight" elif bmi< 35 : bmi_type...
77dfb1b8f1d81f1f97efecb7729ec6c420e49f19
bencebalint/flask-exmple-4-ITBraniacs
/school/element/teacher.py
591
3.84375
4
from typing import List from element.person import Person class Teacher(Person): def __init__(self, name: str, address: str): super().__init__(name, address) self.__courses: List[str] = [] def add_course(self, course: str) -> bool: if len(self.__courses) < 3: self.__cour...
4f875dec97a13dffaee8f8a74aaead27c146ce7b
bencebalint/flask-exmple-4-ITBraniacs
/school/element/student.py
881
3.5625
4
from typing import List from element.person import Person class Student(Person): def __init__(self, name: str, address: str): super().__init__(name, address) self.__courses: List[str] = [] self.__grades: List[int] = [] def __str__(self) -> str: datas = [] for i in ran...
2ea3832c8ad23a22e48d400c8f339afb31a9e0c7
podhmo/metashape
/examples/openapi/17with-newtype-userdefined/value.py
904
3.53125
4
import typing as t class Person: name: str MyPerson = t.NewType("MyPerson", Person) OptionalMyPerson2 = t.NewType("OptionalMyPerson", t.Optional[Person]) OptionalMyPerson3 = t.NewType("OptionalMyPerson2", t.Optional[MyPerson]) MyPeople = t.NewType("MyPeople", t.List[Person]) MyPeople2 = t.NewType("MyPeople2", ...
82a9de7d33683f6a4ed1f0ca5f2c943abe686dfb
group15bse/BSE-2021
/src/Chapter7/exercise2.py
418
3.5625
4
try: mylist=[] name=input("Enter file name:") file=open(name,"r") count=0 for line in file: if line.startswith("X-DSPAM-Confidence:"): count+=1 trim=line.find(":") extract=float(line[trim+1:]) mylist.append(extract) print("Average spam conf...
a32d035229cee38a3af279ca22b76f2da5c9f977
group15bse/BSE-2021
/src/chapter2/exercise3.py
215
4.0625
4
#input for users' hours Hours = float(input("Enter hours: ")) #input for uers' rate Rate = float(input("Enter rate: ")) #computing gross pay Gross_pay = Hours * Rate #printing users gross pay print("Pay:",Gross_pay)
ffc634fec45abf85122b2fcad063be3e4dc9e703
group15bse/BSE-2021
/src/chapter8/exercise1.py
176
3.59375
4
def chop(list): print(list[1:-1]) def middle(list): middle = (list[1:-1]) print(middle) list = ['goat','cow','cat','sheep','dog','hen'] chop(list) middle(list)
da98d3c00028d3245a9233eb93c15c37998c5ff5
wgwus/py_code_test
/test/process/process_test.py
926
3.515625
4
import time from multiprocessing import Process def io_task(): # time.sleep 强行挂起当前进程 1 秒钟 # 所谓”挂起“,就是进程停滞,后续代码无法运行,CPU 无法进行工作的状态 # 相当于进行了一个耗时 1 秒钟的 IO 操作 # 上文提到过的,IO 操作可能会比较耗时,但它不会占用 CPU time.sleep(1) def main(): start_time = time.time() process_list=[] for i in range(5): proce...
1f4a5bc0a9639ddbc6766cd478a59c409a4b5e4a
Juhkim90/L8-Boolean-Operators-Random-Number-Generator
/main.py
1,537
4.03125
4
import random print ("Flip coin...") # 1 = heads, 2 = tails coin = random.randint(1,2) if(coin == 1): print ("It is heads!") elif(coin == 2): print ("It is tails!") print ("Rolling die...") # Exercise: Rolling dice die = random.randint(1,6) if (dice == 1): print("You rolled a 1!") elif(dice == 2): prin...
3bdf1be2bed2efb16e3d387ad70ff17b1136d618
abhijith-AS/Linkedin-Lead-Generator
/selenium_utilities.py
25,088
3.5
4
''' Functions for scraping using Selenium ''' from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common....
9d9b9675c1704e4ca98c541ab602ea0e879f746f
kurodoll/daily-programmer
/301ei/301ei.py
644
3.953125
4
def matches(word, pattern): for i in range(0, len(word) - len(pattern) + 1): checkPattern = pattern j = 0 for c in checkPattern: if 65 <= ord(c) <= 90: if not word[i + j] in checkPattern: checkPattern = checkPattern.replace(c, word[i + j]) ...
b3c11fd84d5dc1bf76111a182a71e76b9ce6fc30
jescobar806/minTic
/fundamentosProgramacion/clase3/ejerciciosPracticaCiclos/11sumaEnteros.py
201
3.78125
4
number1 = int(input("Ingrese el primer entero del rango: ")) number2 = int(input("Ingrese el segundo entero del rango: ")) suma = 0 for i in range (number1,number2+1): suma = suma + i print (suma)
81eb4375f916b88e9cdd3c1ee7c37b20493e32f6
jescobar806/minTic
/fundamentosProgramacion/clase3/ejerciciosPracticaCiclos/14name.py
172
4.03125
4
while True: name = input ("Ingrese su nombre: ") if name == "done": print ("I'm done") elif name == "END": break else: print (name)
7e0b13d878fe75d4705310ab3235babdace6c908
ataylor1184/cse231
/Proj02/proj02.py
2,980
3.796875
4
quarters = 10 dimes = 10 nickels = 10 pennies = 10 price = 0 int_paid = 0 print("\nWelcome to change-making program.") print("\nStock: {} quarters, {} dimes, {} nickels, and {} pennies".format( quarters, dimes, nickels, pennies)) price = input("Enter the purchase price (xx.xx) or 'q' to quit: "...
a194787f8f7e817bf3b7166bcb3b9bce96e024ef
ataylor1184/cse231
/Proj01/Project01.py
1,221
4.46875
4
####################################################### # Computer Project #1 # # Unit Converter # prompt for distance in rods # converts rods to different units as floats # Outputs the distance in multiple units # calculates time spent walking that distance #...
b02608ac822c2cde2573c9d98ac4afcff1bb5f47
LionsoftIT/Python_3.8
/costo_abb_piscina.py
660
3.734375
4
""" Creatore: LEONARDO ESSAM DEI ROSSI E-Mail: leonardo.deirossi@icloud.com """ """ Variabili """ costo_studenti = 35; costo_adulti = 60; studenti_req_sconto = 3; sconto_studenti = 25; totale_adulti = 0; totale_studenti = 0; costo_totale = 0; """ Inserimento dati """ totale_adulti = int(input("Inserisc...
f4d0325182a50724f7e8248572d891f039cf0f7c
zsxoff/optimization-methods
/example_newton.py
791
3.6875
4
#!/usr/bin/env python import misc from simethods.newton_2d import newton_2d from siplot.plot import Dot from siplot.plot_2d import plot_2d def f(x: float, y: float) -> float: """Test function.""" return y**4 + x * y**3 + 2 * (y**2) * (x**2) + y + x**4 - x def main() -> None: """Newton method example.""...
64b50b9c39a3d50ac1c65093c95f44dd9fbea05e
hitrj-lis/my_projects
/probe_01/not_pad.py
2,554
3.5
4
from tkinter import Tk, Menu, Text, messagebox, END, filedialog def context(event): context_menu.tk_popup(event.x_root, event.y_root) def close(): if messagebox.askyesno(exit_out_txt, asky_exit_txt): window.destroy() def new_file(): if messagebox.askyesno(new_file_txt, asky_new_txt): t...
ac338324e89dbd19f2f1212d624d8b6818698311
NeimarS/algoritmos_e_programacao_II
/atividade01.py
3,131
3.984375
4
#Atividade 01 def incluir(): try: nome = input("Digite o nome do produto: ") preco = float(input("Digite o preço do produto: ")) qtde = int(input("Digite a quantidade do produto: ")) if nome != '' and preco > 0 and qtde > 0: lst_nome_produto.append(nome) lst_p...
739483ab59cd0be1df31362e355a814238748a4a
rpadaki/HackPrinceton
/scripts/grapher.py
2,285
3.984375
4
""" Outputs graphs in ready-to-draw format """ import networkx as nx def whole(distances): # graphs all node and connects them to all other nodes, with the length # being a function of the actual distance (no path included) g = nx.DiGraph() # for each key-value pair in distances, adds an edge whose start is the ...
5fdea903da97b47357c07495b106e03e51304005
IsidorosT/Python-1st-Semester-1stYear-2019
/exercise4.py
6,100
3.84375
4
def Zero(*eq): if len(eq) == 0: index = 0 return index else: index = eq[0][0] k = eq[0][1] if k == "+": res = index + 0 elif k == "-": res = 0 - index elif k == "x": res = index * 0 elif k == "/": ...
4748e5ac854c64ffacb466d59367f27094614fd5
sevmardi/Twitter-Sentiment-Analysis
/src/models/Tweet.py
1,214
4.09375
4
class Tweet(object): tweet = "" datetime = "" user = "" sentiment = "" def __init__(self, tweet, user, datetime): """ Creates a tweet object container a tweet """ self.tweet = tweet self.datetime = datetime self.user = user self.sentiment = ''...
9491b3509853916500be73d66b9b906d49015459
KaliNa1488/Pythonparsers
/Minecraft Coord Helper.py
417
3.859375
4
firstx = int(input('Введите целую первую х координату:')) secondx = int(input('Введите целую вторую х координату:')) firsty = int(input('Введите целую первую у координату:')) secondy = int(input('Введите целую вторую у координату:')) x = firstx + secondx y = firsty + secondy print(x / 2, y / 2)
0716618a683fb70c6748e7d6ac45c41b2da7f7b9
vckfnv/Python_datastructure
/datastructure/search추가.py
1,296
3.828125
4
class Node: def __init__(self, data, llink = None, rlink = None): self.data = data self.llink = llink self.rlink = rlink def Search(head,a): while True: if head.rlink.data >= a: return head.rlink break else: head = ...
77a43f1b10cd3b6a57b648acf48c61d1bbb8427e
vckfnv/Python_datastructure
/datastructure/자료구조개론/큐 리스트.py
1,227
3.703125
4
class QQ(): def __init__(self,n): self.q=[] self.front=0 self.rear=0 self.size=n for i in range(n): self.q.append(None) def isFull(self): if (self.rear+1)%(self.size)==(self.front) and self.q[self.rear]!=0: return True else...
1c5147cb238bb21dfe5a7c501f4a386dd5c784ae
MStevenTowns/Advanced-Data-Structures
/Notes/Unordered.py
841
3.703125
4
from Node import * class UnorderedList: def __init__(self): self.head=None def isEmpty(self): return self.head==None def add(self, item): temp=Node(item) temp.set_next(self.head) self.head=temp def size(self): current=self.head count=0 while current!=None: count=count+1 current=current.get_ne...
751bec5cb00f4d04788d5d8ec9a29210f100d2c5
MStevenTowns/Advanced-Data-Structures
/Homework02/BinarySearch01.py
662
3.5
4
''' M. Steven Towns 10/5/16 Homework 02 Part A THIS MUST BE RUN WITH PYTHON 3 ''' def BinarySearch01(A,k): low=0 high=len(A)-1 while True: mid=(low+high)//2 #print(A[mid]) if A[mid]==k: return mid elif A[mid]>k: high=mid-1 else: low=mid+1 if low>=high: return "NIL" usrIn=input("Please giv...
c5e88509fd38193745bace564fcb01025137dbeb
MStevenTowns/Advanced-Data-Structures
/Notes/merge.py
216
3.578125
4
def merge(l1,l2): slot1=0 slot2=0 out=[] while(slot1<len(l1) && slot2<len(l2)): if(l1[slot1]<l2[slot2]): out.append(l1[slot1]) slot1++ elif(l1[slot1]>l2[slot2]): out.append(l2[slot2]) slot2++
8be96399d6e1133f21366fde66e016c184d390a5
mirmozavr/emailsender
/email_sender_html.py
1,299
3.53125
4
import smtplib, ssl from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart port = 465 receiver_email = "" sender_email = "" # input("Type sending email: ") password = "" # input("Type your password: ") message = MIMEMultipart("alternative") message["Subject"] = "multipart test" message[...
0bbbe5e06da128d89c8eef418360a1be724efa29
english5040/Bashing-Adventure
/Thing.py
669
3.515625
4
import yaml import argparse class Thing: """ `Thing` : **`object`** A `Thing` is the lowest common denominator of game entities, and describes anything which can be seen or manifested in-game. """ description = "You're in a room!" def __init__(self, arg): super(Thing, self).__init__() self.arg = arg ...
fd49f2b6597fbd971383f3ae32fba841c00b693b
Hansel-Lin420/Python_Pratice
/1~10no7.py
186
3.703125
4
# -*- coding: utf-8 -*- #輸出1,2,3,4,5,6,8,9,10(沒有7) """ Created on Sun May 10 18:30:36 2020 @author: User """ for i in range(1,11): if(i==7): continue; print(i)
9ac4b6b3da8544f3fb478d871686e73f7c6271e8
Damianpon/damianpondel96-gmail.com
/zjazd 2/zbiory.py
257
3.5
4
zbior = set() print(zbior) zbior.add("x") zbior.add(1) print(zbior) for element in zbior: print(element) print(dir(zbior)) a = {1, 2, 3} b = {2, 3, 4} print(a | b) print((a & b)) print(a - b) print(a ^ b) print(a.pop()) print(a) print(dir(set()))
86c8900f4e6235b6e40d34d8eec993b0ae5541fb
Damianpon/damianpondel96-gmail.com
/zjazd I/zad10.py
610
3.875
4
first_number = int(input("Podaj pierwszą liczbę: ")) second_number = int(input("Podaj drugą liczbę: ")) kind_of_operation = input("Podaj znak operacji: ") if kind_of_operation == "+": result = first_number + second_number elif kind_of_operation == "-": result = first_number - second_number elif kind_of_operat...
793b5d06a3a64bcc3eeefca9fee2e4785ab7295c
Damianpon/damianpondel96-gmail.com
/zjazd I/zadania domowe/zad_domowe_1.py
1,458
4.15625
4
print("Gdzie znajduje się gracz na planszy?") position_of_X = int(input("Podaj pozycję gracza X: ")) position_of_Y = int(input("Podaj pozycję gracza Y: ")) if position_of_X <= 0 or position_of_Y <= 0: print("Gracz znajduje się poza planszą") elif position_of_X <= 40: if position_of_Y <= 40: print("Gr...
366ee9eb1db60a56c69cd137d8404dc5ef24e023
Damianpon/damianpondel96-gmail.com
/zjazd I/kolekcje.py
230
3.828125
4
x = (1, 2, 3, 10, 12, "ala", "mm", 2.0) print(x) print(type(x)) print(dir(x)) print(x.index("ala")) print(len(x)) print(len("Ala")) print(x.count(12)) print(3 in x) print(x[0]) y = "mariola" print(y[::-1]) print(tuple("123"))
9f3c72e251ad5402c5b98099571945e567917bb2
Damianpon/damianpondel96-gmail.com
/zjazd I/zadania domowe/zad_dod4.py
917
3.546875
4
x = int(input("Wpisz ilość pożądanych boków: ")) lengthOfX = str(x) numberOfSteps = lengthOfX listA = [] listA1 = [] for k in range(1, x): listA1.append(k) reverselenght = len(listA1) for y in range(1, x, -1): listA.append(y) lengthOfTheLastOne = len(listA)\ lengthOfTheLastOne = 0 reve...
7d8e32f98b09194f3ea072ae4f0372ca19be9f2b
Damianpon/damianpondel96-gmail.com
/zjazd I/listy.py
279
3.75
4
elementy = [1, 2, 3, 4, 5, "xxx", 2.0, 2] print((type(elementy))) print(list()) # Lista jest mutowalna --> można ją edytować x = elementy.append("cos") print(elementy) print(x) print(len(elementy)) while len(elementy) <11: elementy.append("xx") print(dir(elementy))
20b6485a651ca82c6a96f0952d4f0baf12ad39f4
Damianpon/damianpondel96-gmail.com
/zjazd 2/slownik.py
173
3.53125
4
## pol_ang = dict() pol_ang = {"kot": "cat", "ptak": "bird"} pol_ang["pies"] = "dog" pol_ang["kot"]= "kitten" print(pol_ang) dict_2 =dict(a=18, b=22, c=33) print(dict_2)
63dec67c550b5ed6aa9ed5e7fcc033b8b62c894c
Damianpon/damianpondel96-gmail.com
/zjazd I/zad_6.py
207
3.765625
4
x = int(input("Podaj liczbę: ")) print() print(f"Liczba większa od 10:", float(x)>10) print(f"Liczba jest mniejsza lub równa 15:", float(x)<=15) print(f"Liczba jest podzielona przez 2:", float(x) %2 ==0)
fd7c0e4415f998c40232b1806c18c6178aa694d2
Damianpon/damianpondel96-gmail.com
/zjazd 3/zad5.py
1,214
3.578125
4
class CashMachine: def __init__(self): self.__money = [] @property def cash_is_available(self): return len(self.__money) > 0 def put_money_into(self, bills): self.__money += bills def withdraw_money(self, amount): to_withdraw = [] for bill in sorted(self....
04257917b7ed7b125d67613fcc44d5a0b242c0d5
emna7/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-read_lines.py
282
3.8125
4
#!/usr/bin/python3 def read_lines(filename="", nb_lines=0): with open(filename) as f: i = len(list(f)) if nb_lines >= i or nb_lines <= 0: nb_lines = i f.seek(0, 0) for count in range(nb_lines): print(f.readline(), end="")
ef36fbfb009267f38a6d71d1a5d5aa517395ea38
emna7/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/rectangle.py
3,564
3.71875
4
#!/usr/bin/python3 """ Rectangle Class """ from models.base import Base class Rectangle(Base): """ rectangle class - inherits from Base Attributes: width (obj:`int`): width of rectangle height (obj:`int`): height of rectangle x (obj:`int`): x set of rectangle y (obj:`int`): y s...
2ca02a9db36617d0d668e31bbbff3380ce863838
emna7/holbertonschool-higher_level_programming
/0x02-python-import_modules/100-my_calculator.py
583
3.640625
4
#!/usr/bin/python3 from sys import argv from calculator_1 import add, sub, mul, div if __name__ == "__main__": if len(argv) != 4: print("Usage: ./100-my_calculator.py <a> <operator> <b>") quit(1) a = int(argv[1]) b = int(argv[3]) operators = ["+", "-", "*", "/"] functions = [add, sub...
01622f55a06ffd1f0e208816503eb6a0fb9bda87
emna7/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/6-print_sorted_dictionary.py
140
4.1875
4
#!/usr/bin/python3 def print_sorted_dictionary(my_dict): for y in sorted(my_dict.keys()): print("{}: {}".format(y, my_dict[y]))
e3a896d52f0d82f123bbc356a2a7265f7de95039
buratina/Architecting-Scalable-Python-Applications
/Section 3/hash_stream.py
686
3.515625
4
# Code Listing #1 """ Take an input stream and hash it's contents using MD5 and return the hash digest """ # hash_stream.py from hashlib import sha1 from hashlib import md5 def hash_stream_sha1(stream, chunk_size=4096): """ Hash a stream of data using sha1 """ shash = sha1() for chunk in iter(l...
03ed31b49a395da0b6f58b93711419a3ab005e3c
allhailthetail/optics-cal
/python/tol-to-fringe.py
840
3.8125
4
#!/usr/bin/python # Program to calculate fringes given a tolerance. import math #import pyperclip print( ''' Please Provide Information for the lens: 1. Radius 2. Clear Aperature 3. Given Tolerance ''' ) # Normal Input: radius = float(input('Radius?')) ca ...
1104189d6e3865a24ba56610dda1540b11420b20
AnttiMinkkinen/Blob_goes_brr
/Blob_goes_brr!.py
18,277
3.578125
4
import pygame from math import sqrt from random import randint class GoodGuy: """Player character. Defining color and starting size and location.""" def __init__(self): self.color = (0, 100, 0) self.color_fill = (0, 255, 0) self.radius = 50 self.radius_fill = self.ra...
a1c8f492f6782a3cbe6cb7fbe417c19b792e2206
tech4GT/Pattern-Recognition-Lab
/gaussian.py
318
3.96875
4
import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats import math mu = int(input("Please enter the mean\n")) variance = int(input("Please enter the variance\n")) sigma = math.sqrt(variance) x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100) plt.plot(x, stats.norm.pdf(x, mu, sigma)) plt.show()
4015f8de51d67ec5e32a0aeea0a35216d582c412
brucecass/playground
/nthV2.py
5,023
4.125
4
#!/opt/local/bin/python # # Script name : nthV2.py # Author : BDC # Date : 05.10.15 # Description : play script in order to both try to learn a bit of python and to also try to # hightlight how easy nth term ks3 maths is to Son # import sys def all_same(items): return all(x == items[0] for x in it...
57861ae83e1a21f39b3b996534f45acfd6620b45
RayDiazVega/PF_Python
/ejemplo1.py
1,419
3.5
4
import os import time import threading import multiprocessing NUM_WORKERS = multiprocessing.cpu_count() print("The number of workers is",NUM_WORKERS) def only_sleep(): #Do nothing, wait for a timer to expire print("PID: %s, Process Name: %s, Thread Name: %s" % ( os.getpid(), multiprocessing.cu...
32f7523065558e174f904c617357c5012c663db0
diwu1990/RAVEN
/pe/appr_utils.py
2,089
3.609375
4
import torch import math import matplotlib.pyplot as plt class RoundingNoGrad(torch.autograd.Function): """ RoundingNoGrad is a rounding operation which bypasses the input gradient to output directly. Original round()/floor()/ceil() opertions have a gradient of 0 everywhere, which is not useful when d...
da74ec82c7a56304bf9954cf881198ec978cf781
bmart353011/Week12-utility
/week12-utility.py
1,325
3.546875
4
# Brendan Martin # CSCI 102 - Section A # Week 12 - Part A import string def PrintOutput(output): print("OUTPUT", output) def LoadFile(file_name): with open(file_name) as file: my_list = file.read().splitlines() return my_list def UpdateString(s1, s2, index): my_list = list(s1) my...
1468f557e97a666849aafcd2841fc637b589f6db
Princess-Katen/hello-Python
/04:11:20_Dictionaries_Exercise1.py
324
3.671875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 4 14:51:37 2020 @author: tatyanamironova """ # cat = {"name": "blue", "age": 3.5, "isCute": True} # cat2 = dict(name="kitty", age=5) user_info = {"who": "Katten", "what": "loves", "whom": "Medvezhaten"} for v in user_info.values(): print(v) ...
7f3dc6666df5dbc8b2144dd22a4c175a299aa599
Princess-Katen/hello-Python
/13:10:2020_Rock_Paper_Scissors + Loop _v.4.py
1,696
4.15625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 21 13:18:18 2020 @author: tatyanamironova """ from random import randint player_wins = 0 computer_wins = 0 winning_score = 3 while player_wins < winning_score and computer_wins < winning_score: print (f'Player score: {player_wins} Computer sco...
37d471c52427aa1af23476037ab9d4d45dad2c22
Princess-Katen/hello-Python
/21:09:2020_Looping2.py
193
3.765625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 21 16:26:47 2020 @author: tatyanamironova """ ''' r = range(10) print(list(r)) ''' nums = range(1,10,2) print(list(nums))
024041617a18f2ec2b6ca021d508b012c7a3ae6c
Princess-Katen/hello-Python
/16:11:20_Exercises_Dict_Comp.py
583
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 16 13:30:04 2020 @author: tatyanamironova """ # list1 = ["CA", "NJ", "RI"] # list2 = ["California", "New Jersey", "Rhode Island"] # answer = {list1[i]: list2[i] for i in range(0,3)} # print(answer) ## create a dictionary fron pairs of lists ##va...
76a06af8da9d4aaab65f789c59f8df6abc8eec38
Princess-Katen/hello-Python
/04:11:20_Dictionaries_Iteration.py
404
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 4 14:51:37 2020 @author: tatyanamironova """ # user_info = {"who": "Katten", "what": "loves", "whom": "Medvezhaten"} # for v in user_info.values(): # print(v) # user_info = {"who": "Katten", "what": "loves", "whom": "Medvezhaten"} # user_info....
2eb9e68099b1fd7807e641bb3a9fd320a31fdffc
anmolaj/fansite-analytics-challenge
/src/process_log.py
7,150
3.84375
4
#Importing libraries import pandas as pd import re #Writing a function to clean our input log file and grab the required fields def clean(line): """ input (str) : this is each line contained in the file to be processed output : It returns a list of the required fields obtained froma a particular line ...
6f6830437b7ced47cae83ad94da9c51572deefcc
oscarsun95/CodilitySolutions_Oscar
/ladder.py
362
3.640625
4
def fibonacci(N): fib = [0] * N fib[0] = 1 fib[1] = 1 for i in range(2, N): fib[i] = fib[i-1] + fib[i-2] return fib def solution(A, B): # write your code in Python 3.6 M = max(A) fib = fibonacci(M+1) N = len(A) res = [0] * N for i in range(N): res[i] = fi...
2ddaae1473bf97a58f0b14606208bfbdeef90f49
clarissabailarina/aprendizado
/operacoes.py
229
3.96875
4
"""Este programa fara a soma, subtracao e divisao de varios numeros""" a = 4 b = 3 print('a soma de a e b e: ' + str(a + b)) print('a multiplicacao de a e b e: ' + str(a * b)) print('a subtracao de a e b e: ' + str(a - b))
85839b4d55ce0a406a14b26b6366a931c5fb4ce0
Jhawk1196/CS3250PythonProject
/src/fontSelect.py
855
3.796875
4
def font_style( custom_font, font): """ Changes font family :param custom_font: font used by Message in Tkinter GUI :param font: font the user selects :return: font used by GUI """ custom_font.config(family=font) return custom_font def font_size( custom_font, f_size): ...
e35614c31409fe9144bc7695ee3249a752fd527a
prateek-chawla/DailyCodingProblem
/Solutions/Problem_114.py
583
3.859375
4
def reverseWords(inp): i, j = 0, len(inp)-1 lDelim, rDelim = ' ', ' ' while(i <= j): # print("hello") if inp[i].isalpha() and inp[j].isalpha(): i += 1 j -= 1 elif not inp[i].isalpha(): while i <= j and not inp[i].isalpha(): lDelim +...
556c8b35139d8948b0c218579785dd640b57acde
prateek-chawla/DailyCodingProblem
/Solutions/Problem_120.py
1,456
4.1875
4
''' Question --> This problem was asked by Microsoft. Implement the singleton pattern with a twist. First, instead of storing one instance, store two instances. And in every even call of getInstance(), return the first instance and in every odd call of getInstance(), return the second instance. Approach --> Create two...
14964f7ecbb0c39de4336bab70204958e11aa047
prateek-chawla/DailyCodingProblem
/Solutions/Problem_116.py
1,171
3.953125
4
''' Question --> This problem was asked by Jane Street. Generate a finite, but an arbitrarily large binary tree quickly in O(1). That is, generate() should return a tree whose size is unbounded but finite. Approach --> Use python lazy properties to generate a tree Node's left and right are only computed the first time...
a72e6635f6b8b8a2d44855fd4ce8a476759c20e1
alsoamit/Python-IITK-Workshop-Files
/Day1/P14.py
177
3.515625
4
# P14 def main(): s = int(input()) h=s//3600 m=(s%3600)//60 s=(s%3600)%60 print("{}:{}:{}".format(h,m,s)) if __name__ == "__main__": main()
5de889cd0b58f66572c510b0199b2df2f36b34f0
alsoamit/Python-IITK-Workshop-Files
/Day3/P32.py
455
4
4
# P32 def main(): # Take the input string = input() # Check if "bad" exists if string.find("bad") != -1: # Check if "not" is before "bad" if string.find("not") < string.find("bad"): part1 = string.split('not')[0] part2 = string.split('bad')[1] print(...
9cfb3bc8d97e5bed4b0b43f7d2dd9a87f192b889
alsoamit/Python-IITK-Workshop-Files
/Day4/P44.py
246
3.609375
4
# P44 def RecSum(n): if n <= 9 and n >= 0: return n s = 0 for i in str(n): s += int(i) return RecSum(s) def main(): #take input n = int(input()) print(RecSum(n)) if __name__ == "__main__": main()
2d73419d6d19a82b5d8b254a9ead8f89f3c71662
alsoamit/Python-IITK-Workshop-Files
/Day4/P42.py
1,928
3.734375
4
# P42 quiz_max, exam_max, assignment_max, project_max = 20, 100, 100, 50 def inputCheck(type, type_max): # Checking input if type > type_max: return ("ERROR: Invalid Marks {} > {}".format(type, type_max)) elif type < 0: return ("ERROR: Invalid Marks {} < {}".format(type, 0)) def read_mark...
94f45d00da655948c4efacef3f1918ee06fadc36
evmaksimenko/python_algorithms
/lesson1/ex9.py
480
4.4375
4
# Вводятся три разных числа. Найти, какое из них является средним (больше одного, но меньше другого). a = int(input("Введите первое число: ")) b = int(input("Введите второе число: ")) c = int(input("Введите третье число: ")) r = a if a < b < c or c < b < a: r = b if a < c < b or b < c < a: r = c print("Среднее ...
40c7b3a00d05e1618a7a9bc16543e28d8ca048d0
evmaksimenko/python_algorithms
/lesson1/ex7.py
1,096
4.40625
4
# По длинам трех отрезков, введенных пользователем, определить возможность существования треугольника, # составленного из этих отрезков. Если такой треугольник существует, то определить, # является ли он разносторонним, равнобедренным или равносторонним. a = int(input("Введите первую сторону: ")) b = int(input("Введите...
8e5c8f5ee8b8540d1c9d91dee38b44d67da57580
franky-codes/Py4E
/Ex6.1.py
433
4.375
4
#Example - use while loop to itterate thru string & print each character fruit = 'BANANA' index = 0 while index < len(fruit): letter = fruit[index] print(letter) index = index + 1 #Exercise - use while loop to itterate thru string backwards fruit = 'BANANA' index = -1 # because len(fruit) - 1 is the last i...
0c514c1be8e3fa34e109b2dd0ff7fe1f7c699160
JoaoPauloPereirax/Python-Study
/Mundo2/WHILE/while011.py
1,164
3.9375
4
'''Faça um programa que jogue par ou ímpar com o computador. O jogo será encerrado quando o jogador PERDER, mostrando o total de vitórias consecutivas que ele conquistou no final do jogo. ''' from random import randint computador=0 vitorias=0 while True: jogador=str(input('Par ou ímpar(P/I): ')).upper() if joga...
8e447141bae311f753957bbb453083c485694a0d
JoaoPauloPereirax/Python-Study
/Mundo2/WHILE/while003.py
1,146
4.25
4
'''Crie um programa que leia dois valores e mostre um menu na tela [1] Somar [2] Multiplicar [3] Maior [4] Novos números [5] Sair do programa Seu programa deverá realizar a operação solicitada em cada caso.''' valor1=int(input('Digite o valor1: ')) valor2=int(input('Digite o valor2: ')) escolha=0 while escolha!=5:...
e8309ecf0e484b9ffcffc02dda25e9af28c8cca1
JoaoPauloPereirax/Python-Study
/Mundo2/WHILE/while001.py
296
4.125
4
'''Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores 'M' e 'F'. Caso esteja errado, peça a digitação novamente até ter um valor correto.''' sexo='a' while (sexo.upper()!='M' or sexo.upper()!='F'): sexo=str(input('Digite seu sexo(m/f): ')) print('Fim do programa')
47553ba19892329d2a81aa710376ab378aee5a20
JoaoPauloPereirax/Python-Study
/Mundo2/WHILE/while007.py
304
4.09375
4
'''Escreva um programa que leia um número n inteiro qualquer e mostre na tela os n primeiros termos de uma sequência de fibonacci.''' n=int(input('Digite um número: ')) anterior=1 atual = 0 cont=1 while cont!=n: print(atual) atual+=anterior anterior=atual-anterior cont+=1 print(atual)
40f3df0f533c2b2102e04bcbcb7987b59b4873df
JoaoPauloPereirax/Python-Study
/Mundo2/IF/ex0007.py
805
3.953125
4
''' Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu IMC e mostre seu status, de acordo com a tabela abaixo: - Abaixo de 18.5: Abaixo do peso. - Entre 18.5 e 25: Peso ideal. - Entre 25 e 30: Sobrepeso. - Entre 30 e 40: Obesidade. - Acima de 40: Obesidade Mórbida. ''' peso=float(input('Digite ...
c958ea3e1169ff4cc63527450ea930bb2c10fecc
JoaoPauloPereirax/Python-Study
/Mundo2/FOR/Estrutura_For.py
155
3.890625
4
for variavel1 in range(1,6,1):#contagem até 5 print(variavel1) print('\n') for variavel2 in range(5,0,-1):#contagem ao contrário print(variavel2)
3365f9d6d1cece7c83a21e4a34e80030e59c9d81
cammbyrne/Homework2
/RetirementTest.py
729
3.53125
4
from RetirementCalc import retirementCalc import unittest class RetirementTest(unittest.TestCase): def retirementCalcTest(self): agemet = retirementCalc(25, 6500, .5, 150000) self.assertEqual(agemet, (59.0, False)) agemet = retirementCalc(10, 5, .1, 1000000) self.asser...
0f2ec4c6c12bbd4f53deca24ba9d265c59e50c31
iulihardt/pythonCodes
/Pythons/recognize.py
864
3.765625
4
import speech_recognition as sr #Funcao que converte fala em texto. def voz_to_text(): microfone = sr.Recognizer() #identifica o microfone with sr.Microphone() as source: microfone.adjust_for_ambient_noise(source) #aplica módulo de reduçao de ruido print("Diga alguma coisa: ") #solicita para f...
44e4a9c5c57a9e799d7933573cea95fb3501d884
ivanakonatar/Homework04
/zad6.py
219
3.625
4
#za dati broj vratiti listu pozicija na kojima se pojavljuje u proslijedjenom nizu niz=[1,2,3,4,5,3,7,7] broj=3 pozicije=[] for i in range(len(niz)): if niz[i] == broj: pozicije.append(i) print(pozicije)
542c87a9db36ea07387fec814dd57a0d8a6a73cf
KirillKatranov/hw_python_oop-master
/homework.py
3,628
3.71875
4
import datetime as dt class Record: def __init__(self, amount, comment, date=None): self.amount = amount self.comment = comment if type(date) is str: self.date = dt.datetime.strptime(date, '%d.%m.%Y').date() else: self.date = dt.d...
a1d9320dd8b18e908293e154403bf4c631c49b21
Anushad4/Python-Deeplearning
/ICP1/reversing a string.py
374
4.15625
4
#def reverse(string): # string = string[::-1] # return string #s = "Anusha" #s = input() #print(s) #print(reverse(s[2::])) lst = [] n = int(input("Enter number of elements : ")) for i in range(0, n): ele = input() lst.append(ele) a = "" for j in lst: a += j print(a) def reverse(string): string = ...
1d0e46aa84b87da5c2d417517b11bff21a5c1e01
Anushad4/Python-Deeplearning
/ICP4/2.py
1,028
3.5625
4
#importing data# import pandas as pd glass_data = pd.read_csv('glass.csv') #Preprocessing data x=glass_data.drop('Type',axis=1) y=glass_data['Type'] #Splitting Data# # Import train_test_split function from sklearn import model_selection # Split dataset into training set and test set X_train, X_test, y_train, y_test...
81f95bd75db65db8d3377b220ca0a94f7aea2418
gpizzigh/aula_git
/Aluno1.py
201
3.875
4
n=int(input("Digite o maximo de numeros:")) def ler_numeros(n): l=[] for i in range(n): x=float(input("Digite os numeros:")) #l=[] l.append(x) i=i+1 return l print(ler_numeros(n))
9ceb8c4bf65b297a13a57ca2da6196ea34b5dfd7
1234doraver/ERGASIES-PYTHON
/ERGASIA1.PY
1,642
3.609375
4
#!/usr/bin/python # -*- coding: utf-8 -*- #Ανοιγουμε το αρχειο και αποθηκευουμε ολο το κειμενο σε μια μεταβλητη import os fin=open("text.txt","r") text=fin.read() fin.close() #Αφαιρουμε τα πολλαπλα κενα text=os.linesep.join([s.strip() for s in text.splitlines() if s]) text=" ".join([s.strip() for s in text.split(" ") i...
4be6ec0e941d20b3dd48ec0716ffada5dacf1ce3
sianux1209/algorithm_study
/BAEKJOON/music_scale.py
230
3.78125
4
# https://www.acmicpc.net/problem/2920 scale = ["1 2 3 4 5 6 7 8", "8 7 6 5 4 3 2 1"] input = raw_input() if input == scale[0]: print "ascending" elif input == scale[1]: print "descending" else: print "mixed"
1a6ff0b59d09d28340cf632ab45ba21c5e55ef41
DhanyaMohandas/Basic-Python
/sumofseries.py
74
3.546875
4
n=input('Enter a number=') print 'Sum of Series=' , n + n * n + n * n * n
187b7542fb5bdca5f1261a2aacdc5120988e2a44
mcmk21348/task06.04.2020
/Task_2.py
399
3.859375
4
""" @Makers Write a function square_number that takes in a number and squares it. """ def square_number(number): return number ** 2 #DO NOT remove lines below here, this is designed to test your code. def test_square_number(): assert square_number(2) == 4 assert square_number(8) == 64 assert...
9dcddbcc8d5d3f81e9b43c1b674bb99bf74081e6
LukazDane/CS-1.3
/bases/bases.py
4,209
4.25
4
import string import math # ##### https://en.wikipedia.org/wiki/List_of_Unicode_characters # Hint: Use these string constants to encode/decode hexadecimal digits and more # string.digits is '0123456789' # string.hexdigits is '0123456789abcdefABCDEF' # string.ascii_lowercase is 'abcdefghijklmnopqrstuvwxyz' # string.asc...
07f903f617140f237a316552d095f851f9b0666d
jisu0/test1
/010.py
488
3.984375
4
#! /usr/bin/env python ''' def mySum(n1: int, n2: int) -> None: print(f"{n1} + {n2} = {n1+n2}") mySum(2,3) mySum(5,7) mySum(10,15) ''' def mySum(n1: int, n2: int) -> None: print(f"{n1} + {n2} = {n1+n2}") res1 = mySum(2,3) res2 = mySum(5,7) res3 = mySum(10,15) print("---------") print(res1) print(res2) prin...
9caff2941c21b054385a6c21789c3e7caa59eeb5
jisu0/test1
/003.py
158
3.96875
4
#! /usr/bin/env python num1 = 3 num2 = 5 print(num1 + num2) print(num1 - num2) print(num1 * num2) print(num1 / num2) print(num1 % num2) print(num1 ** num2)
d7b84a1be3c85a5e7d5d7e502c6fe137e166a846
Kartik2301/Python-Tkinter
/converter.py
835
3.953125
4
from tkinter import * window = Tk() window.title("Mile to Km converter") window.minsize(width=300, height=150) window.config(padx=60, pady=30) miles_input = Entry(width=10) miles_input.grid(row=0, column=1) miles_input.grid(padx=10) miles_input.insert(END, "0") miles_label = Label(text="Miles") miles_label.grid(row=...
00145c69d8b8f05411e2a21dce8cbbcee8f032c3
amlalejini/lalejini_checkio_ws
/electronic_station/weak_point/weak_point.py
2,158
3.90625
4
''' Task: The durability map is represented as a matrix with digits. Each number is the durability measurement for the cell. To find the weakest point we should find the weakest row and column. The weakest point is placed in the intersection of these rows and columns. Row (column) durability is a sum of cell dura...
4ec00b56f34cdfbcc64241c4a8ea12bd8bbc3d3d
1aaronscott/Graphs
/projects/ancestor/ancestor.py
1,311
4.09375
4
''' Find the earliest ancestor of a node ''' from graph import Graph def earliest_ancestor(ancestors, starting_node): ''' Input: list of ancestor tuples and a starting point. First value in tuple is the parent, remainder are children. Output: longest graph path from given starting node. ''' # make a l...