blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
e9cbadf4437747276d3c61399447e502b2c5a4a7
BJWiley233/Python-College-Course
/Dice Roller.py
5,361
4.1875
4
""" Created on Sun Jun 3 18:19:42 2018 @author: bjwil Assignment #6 - Dice Rolling Simulator """ #import random for roll function, statistics for mean, time for rolling time import random import statistics as stat import time #function for random roll of dice. List is for a 6-side die. def roll(num_of_dice):...
d0bcee2e77b171bb99e08839aa9560cbac70bfd4
qu0cquyen/Coffee_Machine
/Problems/Tax brackets/task.py
330
3.84375
4
income = int(input()) tax = '' if income < 15527: tax = 0 elif 15528 < income < 42707: tax = 15 elif 42708 < income < 85414: tax = 22 elif 85415 < income < 132406: tax = 26 else: tax = 28 tax_value = income * (tax / 100) print("The tax for {} is {}%. That is {:.2f} dollars!".format(income, tax, ta...
ecec77f3f46f769cac425b1c6d59fc2b1b98609f
siverka/adaptive-python-en
/Step 049 Sum of all elements.py
78
3.5625
4
i = int(input()) s = 0 while i != 0: s += i i = int(input()) print(s)
f62ce395d588d7189bbab95de728b3c389d5248c
j-scull/Python_Data_Structures
/dynamic_array.py
2,012
4.15625
4
import ctypes class DynamicArray: """ A dynamic array class - a simplified version of a python list """ def __init__(self): """ Creates an empty array """ self._n = 0 self._capacity = 1 self._A = self._make_array(self._capacity) def __len__(self): ...
2b793667ed5d6d10cf289a4bd06f0bdde16f2b89
aLonelySquidNamedBob/Random-Projects
/Fractal tree/turtle_speed_test.py
273
3.5625
4
import turtle import time t1 = turtle.Turtle() t1.speed('fastest') t2 = turtle.Turtle() t2.speed('fastest') start = time.time() t1.forward(100) elapsed = time.time() - start print(elapsed) start = time.time() t2.goto(100, 0) elapsed = time.time() - start print(elapsed)
533a0bd7d1f1eae1a6ec5e179cdc84e76ef5731a
gfsmith/gears
/gears/geometry/twod_operations.py
3,114
3.5
4
from math import sin, cos, pi, degrees, radians, atan2 from point import Point from line import Line from arc import Arc from circle import Circle from polyline import Polyline from block import Block from vector import Vector from affinematrix import AffineMatrix def rotateAboutPoint(geom, p, radianAngle): ''' ...
e6d4ca5a770c45d0bd4db816b9e172100973f51d
Zeztron/Harvard-cs50x
/Problem Set 6/sentimental/caesar.py
718
4.03125
4
import cs50 import sys def main(): # checking if command line is acceptable. if len(sys.argv) != 2: print("Missing command-line argument.") exit(1) # Insert Key key = int(sys.argv[1]) print("plaintext: ", end = "") plaintext = cs50.get_string() # Print out cypher-text ...
5970b9c2b5f7c7cdc8fd7c5aa23f7769448172f5
SaladkevichM/exercism
/python/word-count/word_count.py
727
3.765625
4
import string def word_count(phrase): dict = {} punct = string.punctuation.replace("'","").replace(",","").replace("_","") replace_punctuation = string.maketrans(punct, ' '*len(punct)) replace_whitespace = string.maketrans(string.whitespace, ' '*len(string.whitespace)) words = phrase.expandta...
cf70830b780d0c13be44f391cea267da68296f2d
mariabrb/python
/imp y par.py
406
3.8125
4
def sumadedigitos(): pares=0 numero=input("dime un numero") impares=0 while numero!=0:#IMPORTANTE EL != SIGNIFICA DISTINTO DE cifra=numero%10 if cifra%2==0: pares=pares+1 else: impares=impares+1 numero=numero/10 print "Tiene ", pare...
79128068457bd78c413f8f7c0fda1da9c34761b4
krystian-kopaniarz/CDV
/instrukcje_warunkowe.py
583
3.765625
4
x = 5 if x == 5: print("x jest rowne 5") x = str(x) print("Wyswietlam wartosc x: " + x) else: print("x nie jest rowne 5") x = str(x) print("Wyswietlam wartosc x: " + x) ######################################## y = True if y: print("\nPrawda") else: print("\nFalsz") ###################...
aa6d0021d743c74c87003eadd0d043e915490eb4
urjits25/leetcode-solutions
/LC155.py
1,764
3.796875
4
''' MIN STACK Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. * push(x) -- Push element x onto stack. * pop() -- Removes the element on top of the stack. * top() -- Get the top element. * getMin() -- Retrieve the minimum element in the stack. Singly-Linked List imple...
50ac8b373a1725f859cd101c5f23e2e8639f336b
kamit28/python-stuff
/src/com/amit/practice/list_comp_test.py
760
3.6875
4
''' Created on 22 Mar. 2018 @author: Amit.Kumar1 ''' if __name__ == '__main__': n = int(input()) student_list = [[input(), float(input())] for _ in range(n)] student_list.sort(key=lambda student: student[1]) index = 1 while index < len(student_list) and student_list[index][1] == student_l...
c1c161e63fe736e3ee264c8d234ddebc1dab0aae
Aniket-jha/Oop-coffee-machine
/main.py
748
3.515625
4
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine # menu_item=MenuItem() menu_of_coffee=Menu() making_coffee=CoffeeMaker() machine_with_money=MoneyMachine() is_on = True while is_on : options = menu_of_coffee.get_items() name_of_coffee = input(f"Wh...
4d7223b22d3f7e9946236cc34fd146981d00b5d7
SeanSyue/Ch09-ipynb
/unitconverter/unit_tables/temperature.py
504
3.5
4
from .. import UnitTable class temperature(UnitTable.UnitTable): def __init__(self): UnitTable.UnitTable.__init__(self) # Base unit is Kelvin self.base_unit = 'k' # Degrees Celsius self.to_base_unit['c'] = lambda x: x + 273.15 self.from_base_unit['c'] = lambda x:...
a97ea10ac4fdf1e05c4a9bac2d4bb625a5d13064
Trinadhbabu/Artificial-Intelligence
/correlation and regression lines recap 2.py
471
3.875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 29 22:34:10 2020 @author: Trinadh.Singaladevi """ x = [15,12,8,8,7,7,7,6,5,3] y = [10,25,17,11,13,17,20,13,9,15] def avge(a): return sum(a)/len(a) def slope(x,y): x_dash = avge(x) y_dash = avge(y) numerator = sum([(yi-y_dash) ...
70f75ab1b6477535b81a0b151ee6bd8a58137acb
sih4sing5hong5/huan1-ik8_gian2-kiu3
/對齊TGB/空白斷詞分析器.py
801
3.640625
4
from 臺灣言語工具.解析整理.拆文分析器 import 拆文分析器 class 空白斷詞分析器: _分析器 = 拆文分析器() def 切出章物件(self,斷詞): 章物件=self._分析器.建立章物件('') 句字串陣列=self._分析器.拆章做句(斷詞) for 句字串 in 句字串陣列: 章物件.內底句.append( self.切出句物件(句字串) ) return 章物件 def 切出句物件(self,斷詞): 組物件=self._分析器.建立組物件('') for 詞 in 斷詞.split(): 詞物件=self._分析器.建立詞物件(詞) 組...
d4b1f3503836b590b97b3f5782659b01d357b640
faizalazman/UTArlingtonX--CSE1309x-Introduction-to-Programming-Using-Python
/Week 2/Quiz 1 Part 4.py
567
4.0625
4
# -*- coding: utf-8 -*- """ Created on Sun Apr 1 13:33:45 2018 @author: Parmenides """ # ============================================================================= # Part 4 (This Part Has 1 program ) # 10.0/10.0 points (graded) # Write a program that asks the user for an integer 'x' and prints the value of y afte...
1981d5451eeacfe6a0d75c376a2d8f441d878177
an-empty-string/ibot2
/Authenticator.py
3,010
3.65625
4
import ClientCookie import urllib import urllib2 from Iodine import * from IodineException import * from BeautifulSoup import * class Authenticator: """ Authenticator is a class which interfaces with the Iodine authentication system. It submits an HTTPS POST request containing a username and password. Iodine then r...
c361b9aeb879c9e2652d1e1b78b3daf825dd8de2
justAnotherMathmo/CrypticConstructor
/assembler.py
6,275
3.90625
4
import numpy as np import re # flag that indicates when we should backtrack class BacktrackException(Exception): pass def backtrack_search(answers, size, symmetric): BLANK = ' ' VOID = '#' # all letters in the completed grid board = np.array([[BLANK for j in range(size + 2)] for i in range(size...
6172b03d467bc6e6c3a5b2733482289cb56064bd
southpawgeek/perlweeklychallenge-club
/challenge-195/robert-dicicco/python/ch-1.py
630
4.15625
4
#!/usr/bin/env python ''' AUTHOR: Robert DiCicco DATE : 2022-12-13 Challenge 195 Special Integers ( Python )   SAMPLE OUTPUT python .\SpecialIntegers.py Input: $n = 15 Output: 14   Input: $n = 35 Output: 32 ------------------------------------------------- '''   def CheckUniqueDigits(n) : seen = {...
d90865891fb6dacf7c115e82023fa2ac2122cd6f
byterotate/lintcode-answer
/binary-tree/109-triangle.conquer.py
525
3.6875
4
class Solution: """ 这个解法不是时间复杂度合规的,O(2^n)会导致Time Limit Exceeded @param triangle: a list of lists of integers @return: An integer, minimum path sum """ def minimumTotal(self, triangle): return self._minimumTotal(triangle, 0, 0) def _minimumTotal(self, triangle, Y, X): if Y ==...
bf4375fc3fc773d0baa81ee9ba142cf8a4475de1
watchtree/Algorithms_python
/testOffer/Sum_Solution.py
1,136
3.65625
4
#!/usr/bin/env python #-*- coding:utf-8 -*- # author:wttree # datetime:2018/11/28 8:38 # software: PyCharm # question: 求1+2+3+。。+n ''' 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 ''' class Solution: ''' 利用两个函数,一个函数充当递归函数的角色,另一个函数处理终止递归的情况。 如果对n连续进行两次反运算,那么非零的n转换为True,0转换为False。利用...
538b1d4a4bec4550f2d4399fa5b5f0a78ba97d37
david6garcia/proyecto2-evaluacion
/ejercicios-json.py
2,375
3.796875
4
#!/usr/bin/python # -*- coding: utf-8 -*- import json from pprint import pprint fichero=open("/asociaciones-deportivas.json","r") datos=json.load(fichero) opc=raw_input("\n\n 1. Listar los nombres de las asociaciones deportivas de la provincia de Lorca.\n 2. Contar las asociaciones deportivas cuya fecha de constituc...
b503ad75e0ca08320e00f37ac93ec9ec5348ed89
mherreral/dumbest-practice
/slower_max.py
428
3.6875
4
def max_pair(numbers): larg = float("-inf") sec_larg = float("-inf") for number in numbers: if number > larg: sec_larg = larg larg = number elif (number < larg) and number > sec_larg: sec_larg = number return larg * sec_larg if __name__ == '__main_...
767ab3d16c0ebb7bb4cd13bcb2697134a0a161f8
Paletimeena/Prac_data
/Meena (copy)/python/reference-code/loop/loop2.py
332
4.46875
4
#!/usr/bin/python #Basic program of for loop mylist=[1,3,5,7,9] for cntr in mylist: print cntr, mytuple=(1,3,5,7,9) for cntr in mytuple: print cntr, print "Value in integer formate" mylist=[1,3,5,7,9] for cntr in mylist: print bin(cntr) print "Value in float formate " mylist=[1,3,5,7,9] for cntr in mylist: print f...
9020fb22101e00d6b6aa16fa0144d4c1194105de
hyunba/Python_WorkSpace
/GUI_계산기/calculator.py
4,015
3.625
4
import tkinter as tk res_value = 0 oper = {'+' : 1, '-' : 2, '/' : 3, '*' : 4, 'C' : 5, '=' : 6} # 문자를 숫자로 치환을 함 why? 기호를 if문으로 구현하기 위해서 stor_value = 0 pre_oper = 0 def number_click(value): # print('숫자', value) global res_value res_value = (res_value * 10) + value str_value.set(res_value)...
05d7c06ff77e1c7b9671de2e6d3b4e3cb62ade4c
sinobec/python
/Basic/int/copyt.py
457
4.0625
4
def isEqual(a, b): print('True') if a is b else print('False') def ifEqual(a, b): print('True') if a == b else print('False') isEqual(333, 333) isEqual('good', 'good') isEqual(('a', 'b'), ('a', 'b')) isEqual(['a','b'], ['a','b']) isEqual({'a': 'xxx', 'b': 'yyy'}, {'a': 'xxx', 'b': 'yyy'}) ifEqual(333, 333) ifEqual(...
aee174a57b6372cfc8fc215d9f4628bba31bafec
Lohit9/MasterYourAlgorithms
/ctci-python/c1/q4.py
1,308
3.84375
4
# # check whether input string is a permutation of a palindrome # bf # def isPalindrome(s): # s.strip(" ") # l = len(s)-1 # n = (len(s) - 1) // 2 # if (n < 2): # return True # for i in range(n): # if s[i].lower() != s[l-i].lower(): # print s[i].lower(), s[l-i].lower() # ...
568b33c4938a00b4f2422b7e3f108558821a9c27
Jaidev810/Competitive-Questions
/LeetCode/AddLL.py
1,673
3.578125
4
class Node: def __init__(self, data): self.data = data self.next = None def takeinput(): print('enter the data:') inputLL = [int(x) for x in input().split()] head = None temp = None for cur in inputLL: if cur == -1: break newnode = Node(cur)...
d9c19a26d5d57ec5a91db7a7cb929ef9f33e2691
gourav287/Codes
/BinaryTree/TreeTraversal/InOrderWithoutRecursionUsingStack.py
1,586
3.6875
4
""" Implementation of inOrder traversal of a tree The traversal is implemented iteratively with the help of a stack """ # Making the file look into it's parent folder's subdirectories # for modules using sys.path import sys sys.path.append('../') # Importing the already created code for tree creation # This lets us f...
19b853511b06e8ea3262f367352d7079e90fa0bc
fsaraos27/Codigos_Varios
/Edades.PY
1,518
3.609375
4
"""print("") mayor_edad = 0 menor_edad = 0 tercera_edad = 0 cont = 0 n = int(input("Ingresa la cantidad de personas para revisar su edad:\n")) while cont == n: edad = int(input("Ingresa edad para evaluar:\n ", cont)) if edad < 18: print("es menor de edad ", menor_edad = menor_edad + 1) elif edad ...
2ab880bf9058eae0e2e123ad5f59fec75128550d
emsund/misc-python-scripts
/rename_mp4.py
608
3.578125
4
#!/usr/local/bin/python # -*- coding: utf-8 -*- import os, shutil # Feb 19, 2017 # Author: emsund ''' Copy *.mp4 files in a directory to a new dir, with a cropped filename. ''' li = os.listdir() destdir = 'renamed' # Make a folder to store the copies of renamed files try: os.mkdir(destdir) except FileExistsEr...
bec71669bccf3818f858843de8b708c2762fb1bd
EmilStalvinge/LoRa_Communication_Network
/pi/float_encode_decode.py
455
3.734375
4
import struct def encode_float(f: float) -> bytes: """Encode a float as a byte""" return struct.pack("f", f) def decode_float(b: bytes, decimal_points=3) -> float: """Decode encoded bytes into a float If an error occurs, returns 0 """ try: return round(struct.unpack("f",...
d41453b70d118da5823d5ff7ebc7a873d75fd5df
cltrudeau/purdy
/extras/tools/rtfenc.py
1,389
3.84375
4
#!/usr/bin/env python import struct def rtf_encode(text): output = [] data = text.encode("utf-16le") length = len(data) // 2 # Use struct.unpack to turn the pairs of bytes into decimal unicode escape # numbers parts = struct.unpack(f"<{length}H", data) index = 0 size = len(parts) ...
15674a7c82194eeadca30768aa119476f44818ba
sky80830/LPTHW
/exc5.py
572
3.84375
4
my_name = 'David Cools' my_age = 49 my_height = 1.82 #meter my_weight = 120 #kg my_eyes = 'Green' my_teeth = 'White' my_hair = 'light brown' print(f"Let's talk about {my_name}.") print(f"He's {my_height} meter tall.") print(f"He's {my_weight} kg heavy.") print("Actually that is too much.") print(f"He's got {my_eyes} e...
291216d38a31e7912ac3d603df0730b8a9fc71d7
Leonardo220389/Deber
/Deber1/Codigo2/16_Agosto.py
1,592
3.875
4
class Lista: def __init__(self,tamanio=3): self.lista = [] self.longitud = 0 self.size = tamanio def append(self,dato): if self.longitud < self.size: self.lista += [dato] self.longitud +=1 print(self.lista) else: pr...
8bba9b2af1e5a10279f7c156a2634f27ddb9263a
learndevops19/pythonTraining-CalsoftInc
/Day_05/samplecode/sample_basic_logging.py
357
3.5625
4
import logging # logs get skipped due to default log level logging.info("Sample logging example") a = 5 b = 0 try: c = a / b except Exception as e: logging.error("Exception occurred", exc_info=True) # If exc_info is not set to True, the output of the above # program would not tell us anything about the exce...
dc2d4b185565a4a942c59ec893d85878bb87e5bc
Aasthaengg/IBMdataset
/Python_codes/p02262/s225941803.py
636
3.78125
4
def insertion_sort(a,n,g,cnt): for i in range(g,n): v = a[i] j = i-g while j >= 0 and a[j] > v: a[j+g] = a[j] j -= g cnt+=1 a[j+g] = v return a,cnt def shell_sort(a,n,G): cnt=0 for g in G: a,cnt = insertion_sort(a,n,g,cnt) ...
bf50b9b173e1cde36a5eb30a8e46dbf2fc6ef23f
MajidAli44/cv2
/DrawImages.py
805
3.546875
4
import cv2 as cv import numpy as np blank = np.zeros((480, 480, 3), dtype="uint8") cv.imshow("Blank", blank) # paint the image with Certain color # blank[200:300, 250:350] = 0,255,0 # cv.imshow("Color Image", blank) # Draw a Rectangle # cv.rectangle(blank,(0,0),(240,480),(0,255,255),thickness=-1) # cv.rectangle(bl...
c1b37226ec5efed3a7f014f651b39dbea81c40f3
kyleburnette/adventofcode2020
/solutions/dec07/dec07-2.py
710
3.828125
4
#!/usr/bin/env python """dec07-2.py: Solution to Advent of Code December 7th, part 2 """ import string def read_input(filename: str) -> list: data = list() new_entry = list() try: with open(filename) as f: for line in f.readlines(): if line != "\n": ...
2dc33d0e072879b35a1a0ed59999773c1d25e06c
doodoto/keybinds
/conjuguemos.py
1,188
3.53125
4
from pynput.keyboard import Key, Listener from pynput.mouse import Button, Controller import time """ Conjuguemos Author: Josh Richardson Description: this is to help with typing accented letters on https://conjuguemos.com/ graded practice section console help cd accentedletters python conjuguemos.py "...
47e66411469c77d6814a10cd3f5f35651d4a0d3b
wenbinhuang9/RE-to-NFA
/lexer.py
2,050
3.53125
4
import re SEQUENCE = "SEQUENCE" RE_SYMBOL = "RE_SYMBOL" PARENTHESIS = "PARENTHESIS" class Token(): def __init__(self, type, value): self.type = type self.value = value def value(self): return self.value def text(self): return self.value def __repr__(self): re...
a34c527abf3f75fe92ece196b3c928440f752667
evertonpython/TelaDeLoginFacebookTkinter
/facebook02(explicado).py
2,141
3.765625
4
# Projeto desenvolvido por Everton Sousa # GitHub: github.com/evertonpython #coding=utf-8 from tkinter import * # IMPORTAÇÃO DA BIBLIOTECA root = Tk() # DEFINIÇÃO DIRETA, O NOME root FOI OPCIONAL, PODE-SE COLOCAR O QUE QUISER def Login(): if etUsuario.get() == 'admin' and etSenha.get() == 'admin': print...
f12e68456198df968d6b600efed827a8c6be437c
chalk13/softformance_school_exercises
/module_3/min_1.py
1,113
3.984375
4
import datetime # Task 1 name_1 = input("Please enter your name: ") print(f"Hello {name_1}.") # Task 2 name_2 = input("Please enter your name: ") now = datetime.datetime.now() current_year = now.year checker_2 = True while checker_2: try: age = int(input("Please enter your age: ")) checker_2 =...
90db46a56181c74cbcb904839daefeab4b0e6e98
JeanSchuambach/PythonURI
/1012.py
393
3.75
4
Vet1 = input().split() a,b,c = Vet1 float(a) float(b) float(c) Pi = 3.14159 TriRet = (a*b)/2 Circulo = Pi*c**2 Trapezio = ((a+b)*c)/2 Quadrado = b**2 Retangulo = b*a print("TRIANGULO: %1.3f" %TriRet, end='\n') print("CIRCULO: %1.3f" %Circulo, end='\n') print("TRAPEZIO: %1.3f" %Trapezio, end='\n') print("QUADRADO: %1...
9868f51aa414126e3b1915f3a4bd5c2495be47ac
mateo-a/holbertonschool-higher_level_programming
/0x0A-python-inheritance/100-my_int.py
446
4.03125
4
#!/usr/bin/python3 """ Class MyInt that inherits from int """ class MyInt(int): """ Class MyInt that inherits from int an returns the result of == an != operators inverted. """ def __eq__(self, other): """Overrides the default __eq__ implementation""" return super().__ne__(other)...
61405f4ee1b0e5a7b7e0479e5a9078de98de9cb9
SimBuilder23/Phase_One_Assessment
/2-schema-designer/schema_designer_doctors_patients.py.bak.py
839
3.625
4
#!/usr/bin/env python3 import sqlite3 def create_database(): connection = sqlite3.connect("doctors_patients.db", check_same_thread=False) cursor = connection.cursor() cursor.execute( """CREATE TABLE if not exists DOCTOR_PATIENTS( pk INTEGER PRIMARY KEY AUTOINCREMENT, ...
f0e7ec35733c7a4d89cfd92fd194ca0694e632d0
Myrsmeden/adventofcode
/2019/04/part1.py
607
3.65625
4
start = 109165 #end = 123456 end = 576723 def two_digits_are_the_same(number): num = str(number) length = len(num) for i in range(0, length-1): if num[i] == num[i+1]: return True return False def no_decreasing(number): num = str(number) length = len(num) for i in range(0, length-1): if num...
0daa4a1c73399557de1fd2d30edd5daf7e188f89
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/anagram/792d386763ff42759179423a91b65f73.py
446
3.75
4
def detect_anagrams(word, candidates): letters = _to_letters(word) matches = [] for c in candidates: if c.lower() == word.lower(): continue if _to_letters(c) == letters: matches.append(c) return matches def _to_letters(word): letters = {} for char in word.lower(): ...
905ed2849143d02bf8a3f77752ccd3f028c87bef
Inflearn-everyday/study
/hysKim1/2247.py
113
3.546875
4
n=int(input()) s='*' while n>1: t=[i*3 for i in s] s=t+[i+' '*len(i)+i for i in s]+t n//=3 print('\n'.join(s))
9b1e0100e31ce25bf4c56396dbb02a0129026605
KristofferFJ/PE
/problems/unsolved_problems/test_238_infinite_string_tour.py
1,391
3.734375
4
import unittest """ Infinite string tour Create a sequence of numbers using the "Blum Blum Shub" pseudo-random number generator: Concatenate these numbers  s0s1s2… to create a string w of infinite length. Then, w = 14025256741014958470038053646… For a positive integer k, if no substring of w exists with a sum of digi...
e55ea1e6dec43814e5616bb7acb24574b979b911
TVareka/School-Projects
/CS_261/Project 1- Static Arrays/Reverse.py
979
4.21875
4
# Course: CS261 - Data Structures # Student Name: Tyler Vareka # Assignment: #1 Problem 3 # Description: This program will take an array and reverse that array's order completely. The function 'reverse' # alters the original array. from a1_include import * def reverse(arr: StaticArray) -> None: """ ...
cef95eecabac42ef0bd4604ccfb830c30f4c4b39
analuisadev/100-Days-Of-Code
/Day-67.py
631
3.84375
4
def Notes(*notes, situation=False): """ Função para analisar notas e situação de alunos """ results = dict() results['Total'] = len(notes) results['Maior'] = max(notes) results['Menor'] = min(notes) results['Média'] = sum(notes)/len(notes) if situation: if results['Média'] >=...
150fc6e0b85b16159d1f9685c15ef3cccc889781
alfredo-svh/wallbreakers
/week2/longestWordInDictionary.py
1,136
3.78125
4
class Node: def __init__(self): self.isEnding = False self.children = {} class Trie: def __init__(self): self.root = Node() def insert(self, word: str) -> None: nd = self.root for i in range(len(word)): if word[i] not in nd.children: ...
8ff819ecbf03dbc22583ef990169311ed8c5f5eb
hevalhazalkurt/codewars_python_solutions
/6kyuKatas/Array_diff.py
268
3.609375
4
# Solution 1 def array_diff(a, b): if len(b) == 0: return a for i in b: if i in a: for n in range(a.count(i)): a.remove(i) return a # Solution 2 def array_diff(a, b): return [i for i in a if i not in b]
67fce7aa633a5dba74ea1251ca87272c49b3c331
Ariz23746/hackerrank
/Bronze/DrawingBook.py
726
3.65625
4
def pageCount(n, p): middle = n / 2 if p <= middle: if p % 2 == 0: page_count = p // 2 else: if p == 1: page_count = 0 else: page_count = p // 2 else: if n % 2 == 0: if p == n: page_c...
e74380e0cc2d88505e0fd16fe0099a301d184371
AminooZ/coding_interview
/src/coding_interview/arrays_and_strings/string_compression.py
1,128
4.3125
4
# Implement a method to perform basic string compression using the counts of repeated # characters. For example, the string aabcccccaaa would become a2b1c5a3. # If the "compressed" string would not become smaller than the original string, # your method should return the original string. You can assume the string has on...
e5b2dd4666dca253534a299e60c391c631c4843d
asiffmahmudd/Python-Specialization-on-Coursera
/Using Python to Access Web Data/Week 2/Assignment.py
202
3.5
4
import re file_handler = open('file.txt') sum = 0 for lines in file_handler: line = re.findall('[\d]+', lines) if len(line) > 0: for num in line: sum += int(num) print(sum)
ed63be5d338f4167050bd7018c66781e19f7e9a5
jamiels/pythonmasterclass
/07_rental_unit_oop2.py
912
3.625
4
class RentalUnit: def __init__ (self,a,b,c,d,e): self.__address = a self.__rent = b self.__tenant_first = c self.__tenant_last = d self.__eviction = e def get_address(self): return self.__address def set_rent(self,r): if r < 50000: self.__rent = r def __str__(self): print('hey!...
cd1189683ec45499863a1419d242bacc32874677
green-fox-academy/nandormatyas
/week-02/day-02/colors.py
1,192
3.953125
4
# - Create a two dimensional list # which can contain the different shades of specified colors # - In `colors[0]` store the shades of green: # `"lime", "forest green", "olive", "pale green", "spring green"` # - In `colors[1]` store the shades of red: # `"orange red", "red", "tomato"` # - In `colors[2]` store the ...
bcc777c618035e480972a1b9d1ebdd5b44a796d3
rohitpatwa/leetcode
/24. Swap Nodes in Pairs.py
1,263
3.9375
4
# Take curr.next and curr.next.next nodes, swap them and chage pointers, jump two steps from current. # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def swapPairs(self, head): """ ...
597100dc7fa5db2dd789b38efba3b6303a8c2b46
akankshaakanksha/Python-Assignments
/assignment-2/point.py
1,180
4.1875
4
""" An example to show how objects can implement protocols that enable them to be used in comparison and equality tests, and also make them printable. """ "Implementing __str__ enable Point instances to be meaningfully used with" "print statement and str() functions." "Implementing __eq__(), __lt__(), and __gt__() en...
3a286c5c2e8f32e666f16cdadad98d9ecbca127a
danrongLi/Advent_of_Code_2020
/Day2/code.py
1,095
3.640625
4
def readfile(): data = [] with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: raw_data = f.readlines() for item in raw_data: txt = item.split() nums = txt[0].split("-") data.append((int(nums[0]), int(nums[1]), txt[1][:-1], txt[2])) return data ...
218f8f5bc6dc213366ac36c7ae4ca39a34a0f66d
rajivsarvepalli/Python-Projects
/gmuwork/graphs_and_visuals/stack_plotter.py
2,701
3.53125
4
def bar_stack_grapher(values,bar_labels,colors,barwidth=1,legend_values=None,x_label=None,y_label=None,title=None,x_lim=None,y_lim=None,plt_show=True):#modify latetr make eay interface ''' input: values in a array that follow the format that each bar is one row\n bar_labels label what the bars and determine...
5e7f12856bee8665a11d50e9bb11fdcfebb5a175
arvindarrives25/SeleniumGenericMethodsMostUsed
/testmethods/test_date_picker.py
2,274
3.578125
4
import time from selenium import webdriver from testmethods.test_base import TestBase class TestDatePicker(TestBase): driver: webdriver.Chrome """This method will select a specific date""" def test_date_picker_first_example(self): self.driver.get("https://www.redbus.in/") self.driver.maxi...
3fa794a47e917d6c5c563af693de5a80ebd4858b
mahersea/Assorted-functions
/make-consecutive-array.py
408
3.59375
4
# sort list and insert missing values to make the list consecutive def makeArrayConsecutive2(statues): statsort = sorted(statues) newstats = list() for i in range(0,len(statsort)-1): missing = statsort[i+1] - statsort[i] for n in range(1,missing): newstats.append(statsort[i] + n...
ed48d603f105645669d5d0f5b275eb744ffe986a
CXuTao/Python_source
/python_grammar/函数/高阶函数-map与reduce.py
1,481
3.84375
4
from functools import reduce #map就是将数据分开处理,reduce就是将处理好的数据进行合并 #python内置了map()和reduce()函数 #map() #原型 map(fn, lsd) #参数一是一个函数 #参数二是一个序列 #功能:将传入的函数依次作用在序列中的每一个元素,并把结果作为新的Iterator返回 #将单个字符转为对应的字面量整数 def charToint(chr): return {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9}[chr] list...
548ea387c08415302a4130b001252bae2fd21475
jdef1028/Artificial_Intelligence_python
/assignment3/as_of_fc/SudokuStarter.py
7,528
3.984375
4
#!/usr/bin/env python import struct, string, math, copy class SudokuBoard: """This will be the sudoku board game object your player will manipulate.""" def __init__(self, size, board): """the constructor for the SudokuBoard""" self.BoardSize = size # the size of the board self.CurrentGameBoard = board # th...
b98d8d32acc5fb48b2608b3a15453045646d8cec
iorzt/leetcode-algorithms
/insert_into_a_binary_search_tree.py
1,512
3.953125
4
""" Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Note that there may exist multiple valid ways for the insertion, as...
af400d2c708c18ff787eff3501ada624f1295e98
Adeajakaye/python-codes
/conditional.py
207
4.03125
4
def string_length(strings): return len(strings) strings =str(input("please enter your details: ")) if type(strings) == int: print("intergers dont have length") else: print(len(strings))
58fc3f2c0ddf2f38e512400f9c175a97ea24f102
maumneto/IntroductionComputerScience
/CodeClasses/FunctionsCode/cod5.py
1,248
3.796875
4
# Faça um programa que preencha um vetor com 10 elementos numéricos inteiros. # Calcule e mostre: # • todos os números pares; # • a quantidade de números pares; # • todos os números ímpares; # • a quantidade de números ímpares. # 1 criando a função para peencher uma lista com 10 elementos numéricos def preenche_vetor...
f09629c218181e2331341ccb94f272cf063b299d
Lehcs-py/guppe
/Seção_07/parte_2/Exercício_16.py
1,236
4.21875
4
print(""" 16. Faça um programa para corrigir uma prova com 10 questões de múltipla escolha (A, B, c, d ou e), em uma turma com 3 alunos. Cada questão vale 1 ponto. Leia o gabarito, e para cada aluno leia sua matricula (número inteiro) e suas respostas. Calcule e escreva: Para cada aluno, escreva sua matrícula, suas res...
4d241ed526999b10731c718b465d90c53976ad2e
voyagerw/exercise
/动态规划/518.零钱兑换2.py
420
3.546875
4
from typing import List class Solution: def change(self, amount: int, coins: List[int]) -> int: dp = [0] * (amount + 1) dp[0] = 1 for coin in coins: for am in range(coin, amount + 1): dp[am] += dp[am - coin] return dp[amount] Amount = 5 Coins = [1, 2...
1491810bc326298280fd74e4b2cec9975cf5f900
wxx17395/Leetcode
/python code/题库/1028. 从先序遍历还原二叉树.py
1,904
3.828125
4
""" 我们从二叉树的根节点 root 开始进行深度优先搜索。 在遍历中的每个节点处,我们输出 D 条短划线(其中 D 是该节点的深度),然后输出该节点的值。(如果节点的深度为 D,则其直接子节点的深度为 D + 1。根节点的深度为 0)。 如果节点只有一个子节点,那么保证该子节点为左子节点。 给出遍历输出 S,还原树并返回其根节点 root。 示例 1: 输入:"1-2--3--4-5--6--7" 输出:[1,2,5,3,4,6,7] 示例 2: 输入:"1-2--3---4-5--6---7" 输出:[1,2,5,3,null,6,null,4,null,7] 示例 3: 输入:"1-401--349---90-...
681fba3f6d5b0595e604367258c96e98a7ac2e83
gabrieleliasdev/python-cev
/ex044.py
1,250
4.125
4
"""044 - Elabore um programa que calcule o valor a ser pago por um produto, considerando o seu preço normal e condição de pagamento: - à vista dinheiro/cheque: 10% de desconto. - à vista no cartão: 5% de desconto. - em até 2x no cartão: preço normal - 3x ou mais no cartão: 20% de juros""" v = float(input("\n...
c1155d442fb8b6f57cd9132982907dc1a5d48669
Nhahan/algorithm
/algorithm/am_11.py
308
3.515625
4
import math C = int(input()) for cal in range(C): x, y = list(map(int, input().split())) distance = y - x n = math.floor(math.sqrt(abs(distance))) if distance == n ** 2: print(2 * n - 1) elif n ** 2 < distance <= n ** 2 + n: print(2 * n) else: print(2 * n + 1)
9d333080f6d8bb6b32cc6a1e075acd703a49dce4
hamzasiddiqui97/ProgrammingFundamentals
/19B-097-SE List IPU-3.py
3,072
4.46875
4
#!/usr/bin/env python # coding: utf-8 # In[16]: ##1 ###Write Python Program to Find the Largest Number in a List def LargestList(lst): lst_index = lst[0] for i in lst: if i > lst_index: lst_index = i return (lst_index) lst = [2,3,435,34,22,2,-2] func = LargestList(lst) print('Largest...
7b3f91feb1dd9b1fd254135a76c3e13f95c8add5
dandoan1/CIS-2348-python
/Homework 1/Coding Problem 1.py
906
4.03125
4
# Dan Doan 1986920 from datetime import date import math # splitting up the date into separate variables for printing usage later month, day, year = input("Please enter the current month, day and year with spacing between:").split() bdmonth, bdday, bdyear = input("Please enter your birthday with the same forma...
cc2cdcdab65e9e5d1b07010c0e6f42bd0b9763cf
jmplz14/PTC-programacion-tecnica-y-cientifica
/Sesion2/ejercicio1.py
453
3.53125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 4 10:39:27 2019 @author: jose """ precio_bruto = float(input("Introduzca el precio bruto: ")) ganacia = float(input("Introduzca el porcentaje de ganancia: ")) iva = float(input("Introduzca el porcentaje de IVA: ")) precio_base = precio_bruto * (1...
f7d63ceb85dbfaa4da5648086cb6cd9ba5af5b38
matramir/Python3-Scripts
/trent.py
729
4.125
4
#! python3 # trent.py - This simple script uses the os.walk function to show # folders, subfolders and filenames in a given directory. # usage: write trent,py <directory> import sys, os if len(sys.argv) != 2: print ('Please enter the filepath when calling the script as described in the script documentation') e...
f4f2b78a10461b4ad535c36015304859c8bdee44
mukhaimy/PythonTutorialP1
/Soal04.py
1,586
4.03125
4
''' Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder. Misal angka 9 9 / 1...
68ceae36b0cb9a1940cfe024a713ef3c324bed4d
MikeCardona076/REPEAT
/multiplicadordecadenas.py
183
3.96875
4
#Variables word_input=input("Insert text: ") numero_veces=int(input("how many repetitions do you want? ")) g=0 #Ciclo for for g in range(g,numero_veces): print(word_input)
d71553e484cf7f512cd3a7c65fa2f05adcfa6022
patka817/advent_of_code_2020
/day9/part1/main.py
726
3.875
4
#!/user/bin/python # 5 test, 25 real preambleCount = 25 allowedLowestIndex = 0 numbers = [] def isValid(value, amongNumbers): #print(amongNumbers) for first in amongNumbers: for second in amongNumbers: if first + second == value: return True return False with open...
3ef25b2ef2480a6c236406131d4e630db7f4d15c
WariaW/TicTacToe
/tic tac toe game.py
4,078
3.796875
4
import os class TicTacToe(): def __init__(self, size): self.size = int(size) self.board = [[' ']*self.size for i in range(self.size)] self.print_game_board() self.diag1 = lambda: [self.board[i][i] for i in range(self.size)] self.diag2 = lambda: [self.board[i][self.size - 1 ...
d077cf2200dce2573c522c260d20128b96b7b47b
matrixjoeq/timus_solutions
/1131/slu.py
1,915
4.0625
4
#!/usr/bin/python # -*- coding: utf-8 -*- ''' 1131. Copying Time limit: 0.25 second Memory limit: 64 MB [Description] A new educating program was received by the kindergarten. Of course, children have discovered it immediately and want to play with it as soon as possible. In order to let them do it the program has to...
64b4d7908c4c9bf5acf3d3b62c43c051893af920
Passbee/passbee_rep
/lesson3/task1.py
297
3.53125
4
import sys if __name__ == '__main__': sample_str = sys.argv if len(sample_str[1]) > 2: print(sample_str[1][:2] + sample_str[1][-2:]) if len(sample_str[1]) == 2: print(sample_str[1][:2] + sample_str[1][-2:]) if len(sample_str[1]) < 2: print('EMPTY STRING')
da3eae69480ab723f9bbe5775a919cc33dcd3add
noelfonseca/Test_project_1
/archive/turtleDrawing.py
524
3.5625
4
from turtle import * shape("turtle") speed(10) pensize(6) Screen().bgcolor("turquoise") colours = ["blue", "purple", "cyan", "white", "yellow", "green", "orange"] def vshape(): right(25) forward(50) backward(50) left(50) forward(50) backward(50) right(25) def snowflakeArm(): for x in...
6fb152143cf6ffc259f1a2e6a03cfd2e25d03841
Carlos-UR/Info-HCVAE
/preprocesado/txt_constructor.py
2,810
3.546875
4
import argparse import json import pdb def load_json(file): with open(file, "r", encoding='utf-8') as reader: return json.load(reader) def write_text(file, text): with open(file, "w", encoding='utf-8') as writer: writer.write(text) def main(args): input_data = load_json(args.input_file) exce...
2b845e5ba54fffdeeff445aa0521c5308805b112
cscal/practice
/dec-tip-calculator.py
347
4.125
4
# Tip Calculator. This calculator uses decimals instead of floats, for # accuracy in financial calculations. from decimal import Decimal meal = Decimal(input('Enter meal total: $')) tip = Decimal(input('Enter tip percentage: ')) tip = tip * Decimal("0.01") tip = meal * tip total = meal + tip print('Total is: $', total...
4447cc77c27309d19e4a60ae34ff6f377b795433
khyalthatta/miscellaneous
/python/random/practice.py
580
4.03125
4
import pandas as pd columns = ['name', 'club', 'kit_no'] df = pd.DataFrame(columns = columns) while True: name = input("Enter name of a player ") club = input("Enter name of a club ") kit_no = input("Enter shirt no of a player ") df = df.append({'name': name , 'club': club, 'kit_no': kit_no}, ignor...
32088286c46bc1711dbc9a232bbf6b650b80f4ff
jz33/LeetCodeSolutions
/Google Onsite 03 Minimum Modification on Matrix Route.py
2,228
3.875
4
from typing import List, Tuple from heapq import heappush, heappop ''' https://leetcode.com/discuss/interview-question/476340/Google-or-Onsite-or-Min-Modifications Given a matrix of direction with L, R, U, D, at any point you can move to the direction which is written over the cell [i, j]. We have to tell minimum numb...
7e16565c2622cf2ecca28f2b213b308d434d76c4
mikegirenko/python-learning
/chapter_7/dream_vacation.py
408
3.8125
4
prompt = 'If you could visit one place in the world, where would you go? ' prompt += '\nEnter "quit" to exit the program ' active_polling = True places = [] while active_polling: user_response = input(prompt) if user_response == 'quit': active_polling = False else: places.append(user_respon...
c4f31c5ebbf1cd0eec3d014da13b43857916fdd3
ag-ds-bubble/projEuler
/solutions/solution31.py
924
3.515625
4
""" Author : Achintya Gupta Date Created : 22-09-2020 """ """ Problem Statement ------------------------------------------------ Q) In the United Kingdom the currency is made up of pound (£) and pence (p). There are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p), and £2 (200p). ...
e03248eb08dc1f3cbd4fb96ff771dc782fb33077
ravireddy07/LPU-Material
/src/Python Programing/Practiced Files/My Sets Operations & Examples.py
270
3.828125
4
my_set={7,77,777,'a','s'} my_set1={7,0.77,777,'a','srabs'} print('Union='my_set | my_set1) print('Union='my_set1 | my_set) print('Intersecion'my_set & my_set1) print('Intersecion'my_set1 & my_set) print('Difference'my_set - my_set1) print('Difference'my_set1 - my_set)
b75437056b70560a6d9acdf52e5e4e0ada8b2ae4
FelipeD97/day6
/day4/degree_conversion.py
74
3.609375
4
temp = int(input('Temperature in C? ')) print(str(temp * 1.8 + 32) + ' F')
3b332a74070289f0b90d3a8f9807589f16c61e47
Puzyrinwrk/Stepik
/Поколение Python/Неравенство_треугольника.py
1,007
4.125
4
""" Напишите программу, которая принимает три положительных числа и определяет, существует ли невырожденный треугольник с такими сторонами. Формат входных данных На вход программе подаётся три положительных целых числа. Формат выходных данных Программа должна вывести «YES» или «NO» в соответствии с условием задачи. ...
b2795fbab574e9e02f51c8f6a9e5c022487c86d4
CodevilJumper/think_python_inspired
/print_recursion.py
339
4.1875
4
def print_n(s, n): """ :param s: object (str, int, float) :type s: object (str, int, float) :param n: how many times we can print an object :type n: int :return: object printed n-times :rtype: recursion """ if n <= 0: return print(s) print_n(s, n-1) pri...
5deff2ca3f804b7b8f6588ff95b59e0c6dd27c69
gringobrasiliero/Python-Camp
/Students/AlexaEsdras/challenge.py
487
3.609375
4
from random import randint letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # for k in letters: # for j in letters: # for i in letters: # print(i + j + k) def randomLetters(): words = [] while x < 17576: a = randint(0, 25) b = randint(0, 25) c = randint(0, 25) wo...
b1ff4822be75f8fffb11b8c2af5c64029a27a874
prefrontal/leetcode
/answers-python/0023-MergeKSortedLists.py
2,349
4.125
4
# LeetCode 23 - Merge k sorted lists # # Given an array of linked-lists lists, each linked list is sorted in ascending order. # Merge all the linked-lists into one sort linked-list and return it. # # Constraints: # k == lists.length # 0 <= k <= 10^4 # 0 <= lists[i].length <= 500 # -10^4 <= lists[i][j] <= 10^4 # lists[i...
903de0119910b54fa7a5ea0af1a711746e94cd0e
etsaf/python-algorithms
/hanoi_towers.py
650
4.125
4
#show all optimal steps of how to move n discs from rod 1 to rod 3 #for each step print(i, j, h), where i is the number of the disk, #j is the number of the rod it is taken from, h is the number of the rod it is placed on def moveOne(ind, fromRod, toRod): print(ind, fromRod, toRod) def moveTower(indfirst, indlast...