blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
2c462db90bac86347ea07ac7e8c1a230d12cab34
dalaAM/month-01
/day19_all/day19/exercise02.py
621
4
4
""" exercise:使用装饰器,为旧功能增加新功能. """ def print_fun(func):# 拦截(调用旧功能,执行内部函数) def wrapper(*args, **kwargs):# 包裹(执行新+旧功能) print("执行了", func.__name__, "函数") return func(*args, **kwargs) return wrapper # 新功能 # def print_func(func): # print("执行了", func.__name__, "函数") # 旧功能 @print_fun def ins...
96546d75487294307a6e49df40e02c3eebbe832c
PunterGit/StructuralProgramming
/Laba3/Z6.py
171
4
4
import math n = int(input("Введите n ")) x = int(input("Введите x ")) s = 1 for i in range(1, n): s += (math.cos(i * x)) / math.factorial(i) print(s)
4fecf598156df9a1fcad61f9d78b66c1705f40b9
aishwarya07g/SpeckbitLaunchpad
/Problem3.py
125
3.734375
4
num1 = eval(input("Enter a list: ")) num2 = [] for i in range(len(num1)): if num1[i]==2: num2.append(i) print(num2)
13e83b663e3e5fcf43505e4a7133701f5d2db97a
yaoayaoflora/gogoyao
/DataStructuresAlgorithms/grokking-the-coding-interview-patterns-for-coding-questions/3_Fast_Slow_Pointers/3_6.py
1,876
4.28125
4
# Given the head of a Singly LinkedList, write a method to modify the LinkedList such that the # nodes from the second half of the LinkedList are inserted alternately to the nodes from the first half # in reverse order. So if the LinkedList has nodes 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null, # your method should return 1 -...
c8f3c94c82ff4a912740c388cec1b0e1642c19d1
Kyrandis/Zookeeper
/Problems/Difference of times/task.py
331
3.875
4
# put your python code here hours1 = int(input()) minutes1 = int(input()) result1 = int(input()) hours2 = int(input()) minutes2 = int(input()) result2 = int(input()) time1 = (hours1 * 3600) + (minutes1 * 60) + result1 time2 = (hours2 * 3600) + (minutes2 * 60) + result2 # output is in seconds final = time2 - time1 pr...
47604b124541814122d49bc9c8c21f34572968b5
DishantNaik/kg_DishantNaik_2021
/main.py
811
3.5
4
# -*- coding: utf-8 -*- """ Created on Wed Mar 18 17:16:43 2020 @author: iCule10 (Dishant Naik) """ def run(s1,s2): #Both string must be of same length if(len(s1) == len(s2)): tmp_s1, tmp_s2 = {},{} #Assigning key to each value in s1 for i, val in enumerate(s1): tm...
b716b9987677efa593f1ca3370f866328c6753fe
DavidMarquezF/InfoQuadri2
/Practica 7/MergeSort.py
1,046
4.28125
4
#!/usr/bin/env python #-*- coding: utf-8 -*- def mergeSort(l): """ retorna una nova llista ordenada segons el merge sort >>> mergeSort([10,5,25,1,4,3,5,68,2,9]) [1, 2, 3, 4, 5, 5, 9, 10, 25, 68] >>> mergeSort([256,44,32,56,2,134]) [2, 32, 44, 56, 134, 256] """ list = l[:] if len(lis...
9aef0a377798e58e7813147391b272f1557bae96
Zhaisan/PythonDev
/informatics/int arithmetic/m.py
253
3.671875
4
x = int(input()) y = int(input()) z = int(input()) if x % 2 == 0: x = x // 2 else: x = x // 2 + 1 if y % 2 == 0: y = y // 2 else: y = y // 2 + 1 if z % 2 == 0: z = z // 2 else: z = z // 2 + 1 print(x + y +z)
57736873fa1c9c4d839c61c8a14788e117b163de
JayakumarClassroom/Python-Programs
/code/sample-41.py
1,078
4.375
4
#For loop - Quadratic Equation Solver import cmath #welcome message print("Welcome to Quadratic Equation Solver") print("Quadratic Equation is ax^2 + bx + c = 0 ") print("Your solution can be Real or Imaginary") print("Your complex number is a + bj ") print("Where a is the real portion bi is the imaginary portion") ...
8e45df8771b20eeef380aa2f4e67dd5608a98e56
HatlessFox/UNIX-labs
/TEST1/t2.py
344
3.734375
4
#!/usr/local/bin/python3 import sys arg = sys.argv[1] def is_pol(st): return st == st[::-1] def substr(st, code): res = [st[i] for i in range(len(st)) if code & 2**i == 0] return "".join(res) max_p = "" for code in range(0, 2**len(arg)): st = substr(arg, code) if is_pol(st) and len(st) > len(max_p): ...
7ac2281b46afc482f38a90ac430e862d66cb255f
bioJain/python_Bioinformatics
/Rosalind/Bioinformatic-textbook-track/BA1I_FreqWordWithMis.py
1,532
3.75
4
# BA1I # Find the Most Frequent Words with Mismatches in a String # Find the most frequent k-mers with mismatches in a string. # Given: A string Text as well as integers k and d. # Return: All most frequent k-mers with up to d mismatches in Text. # to calculate the hamming distance between two strings from BA1G impor...
9f313ba2d0b10c4731c82bb81e6af49ee71cdbbd
fuLinHu/python
/learn/set.py
251
3.546875
4
#set={2,4,5} #print(type(set)) set1=set("78yttru") print(set1) a={x for x in ("a","e","3") if x != "3"} print(a) b=set() b.add(1) b.add(2) b.add("4") b.add("5") print(b.discard(2)) print(b) a,b=0,1 while b<1000: a,b=b,a+b print(a,end=",")
ea1d4a64de8bf29793354aa346c7c1b86a99f558
Kimberly07-Ernane/Python
/Pacote para dowloand/Python/ex008( if ,elif e while) receber idade e peso.py
792
3.96875
4
#Crie um programa que receba idade e peso de cinco pessoas e calcule: #A maior idade; #A quantidade de pessoas que pesam mais que 90kg; #Média das idades das pessoas que pesam menos de 50 kg. maior=0 qtd90=0 media=0 qtd=0 soma=0 idade=int(input("Entre com a idade:")) while idade >0: peso=int(input("Entre...
9e361efb8a2ecddd5e39dfb6f7dd8c0b285f5dc4
gsourdat/TestRepo
/LogMagasin/Model/user_model.py
663
3.546875
4
print(2) from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String Base = declarative_base() engine = create_engine('sqlite:///:memory:', echo=True) class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) ...
78138901da48f3774cd4a58d8600a9090c2f4e8a
franperez022/LMSGI
/Usuarioxml/4.py
552
3.71875
4
#4) Pedir una cadena por teclado y mostrar todos los usarios #cuyo nombre empieza por dicha cadena (Ejemplo: si meto la cadena "A" #mostrará todos los usuarios cuyo nombre empeiza por A...) from lxml import etree arbol = etree.parse('users.xml') usuarios = arbol.findall("user") cadena = input("Introduce una letra: "...
4fc94f85e4cf6c538535f4ae3a06b41e892eb39c
Dirguis/cepbp
/cepbp/common/custom_error_handler.py
402
3.609375
4
class CustomError(Exception): """ Custom error class, to pass a custom message and data to the user as needed Parameters ---------- msg: string Error message data: anything Whatever data is useful to print """ def __init__(self, msg, data=''): self.msg = msg ...
ee68fb6ff223f3dae8c9460a6cb54fe27c3447b2
lehuutrung1412/CS112.L21.KHTN
/Homework/Week_6/bestSum.py
663
3.578125
4
def findBestSum(arr, sum, memo = {}): if sum in memo: return memo[sum] elif sum < 0: return None elif sum == 0: return [] min_element = None for num in arr: remain = sum - num sum_remain = findBestSum(arr, remain, memo) if not sum_remain is None: ...
0e7671ccbd45a80c1b7435ccf9f89191f4d2b4c6
NechayevAntonn/---
/исходный.py
1,904
3.9375
4
# http://blog.chapagain.com.np/hash-table-implementation-in-python-data-structures-algorithms/ hash_table = [[] for _ in range(10)] #Создание хеш-таблицы в виде вложенного списка (списки внутри списка). def insert(hash_table, key, value): #hash_table -- [[], [], [], [], [], [], [], [], [], []], key -- 10, value -- N...
c5e533812ab141ae1bc66bb37147133d937770ac
Carolina1992Assen/SE
/ku.py~
1,371
3.78125
4
#!/usr/bin/env python3 # Author: Carlijn Assen import sys import numpy as np def is_vowel(letter): l = 0 if letter in ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]: l = 0.5 else: l = 1 return l def ls(x, y): if x == y: return 0 elif len(x) == 0: return le...
e3fc109f6a9aad31a268998a86e624813b2e4bcd
MatthiasHunt/Project-Euler
/euler-07.py
665
4.0625
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 21 19:23:14 2019 https://projecteuler.net/problem=7 @author: matth By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? """ def main(): print(primes(10001)[-1]) def primes(n): """...
ebd54ff62a5918a42095b205aaa71bd95df9dfb4
YuliuSYK/NLP_Test
/5.NLTK_Tokenize.py
628
3.5625
4
from nltk.tokenize import sent_tokenize from nltk.tokenize import word_tokenize mytext = "Hello Adam, how are you? I hope everything is going well. Today is a good day, see you dude." print(sent_tokenize(mytext)) mytext = "Hello Mr. Adam, how are you? I hope everything is going well. Today is a good day, see you dude."...
d6862340307234ad349356f25b5d569d3aafe481
subhi28/python
/hun89.py
87
3.65625
4
str=input() x='' for i in str: if i not in x: x=x+i print(x[::-1])
210101ea57119fd5916d524fd2fcff9ab609c8e5
Mr-Venu/Assignment-WEEK-1
/7.py
125
4
4
print('Printing first m multiples of n') m=int(input('Enter m ')) n=int(input('Enter n ')) i=range(n,m*n+1,n) print(list(i))
02c655efed59f7c923b46e0340f7962a9ba02319
dsluijk/TICT-V1PROG-15
/les-1/perkavic/2-13.py
234
3.671875
4
# Variable assignment s1 = '-'; s2 = '+'; # A print(s1 + s2); # B print(s1 + s2); # C print(s2 + (s1 * 2)); # D print((s2 + (s1 * 2)) * 2); # E print(((s2 + (s1 * 2)) * 10) + s2); # F print((s2 + s1 + (s2 * 3) + (s1 * 2)) * 5);
9ebdaf6a7ee7bfa8cefe855c95c39ec9700a864f
priysha2/concepts
/2.py
287
4.0625
4
def max_of_three(x,y,z): if ((x>y)&(x>z)): print("%d is greater than %d and %d" %(x,y,z)) elif ((y>x) & (y>z)): print("%d is greater than %d and %d" % (y,x,z)) else: print("%d is largest of %d and %d" %(z,x,y)) max_of_three(20,40,10)
908b6fa528a02a36ebceea98b67f695b00884675
ricardo-tapia/CYPJoseMT
/libro/ejemplo1_13.py
360
3.515625
4
CAL1 = float(input("Dame la calificación 1: " )) CAL2 = float(input("Dame la calificación 2: " )) CAL3 = float(input("Dame la calificación 3: " )) CAL4 = float(input("Dame la calificación 4: " )) CAL5 = float(input("Dame la calificación 5: " )) PRO = ( CAL1 + CAL2 + CAL3 + CAL4 + CAL5 ) / 5 imprimir ...
2078b677679d7b13749a54455623cc127a9749a8
Nscampa/hw6-costs
/hw6-costs.py
1,312
4.4375
4
# Function Purpose: To sum up all of the money that has been spent this week # Parameters: None # Return: The sum of all money # Algorithm: Use a sentinel-controlled loop to ask the user for a cost to add to the total. # Return the total at the end of the function. # Assume the user only gives values that are > 0, and ...
ec014dbb877f8de1b876336c56eb15436960671e
omergamliel3/next.py-course-python
/Unit 2 - OOP/animal.py
1,162
3.71875
4
class Animal: count_animals = 0 def __init__(self, name='Animal', age=0): self._name = name self._age = age Animal.count_animals += 1 def __repr__(self) -> str: return f'Name: {self._name}\nAge: {self._age}' def birthday(self): self._age += 1 def get_age(s...
7e519039b56f03d97aff251649c75b29b1a11fa8
sds1vrk/Algo_Study
/Programers_algo/sort/pro_2_fail.py
883
3.5625
4
#가장 큰 수 찾기 def solution(numbers): array=[] for i in numbers: array.append(str(i)) if max(numbers)==0: return '0' array.sort(reverse=True) print(array) def bigo(i, j): a = int(i + j) b = int(j + i) if a >= b: return True else: ...
e0c26c39a165399b8bb9cf9a81740e4a0b115f6a
Conchristador/python-challange
/PyPoll/main.py
1,933
3.625
4
import os import csv PyPollcsv = os.path.join("Pypoll.csv") #Set Variables and Lists count = 0 canlist = [] unique_can = [] v_count = [] v_percent = [] #Open CSV file with open(PyPollcsv, newline="") as csvfile: csvreader = csv.reader(csvfile, delimiter=",") csv_header = next(csvreader) #Count the variabl...
8fa9189e48e1f87b7dfe1fd9fa27f262914cc65a
Malukeh/comp110-21f-workspace
/exercises/ex03/find_duplicates.py
346
3.6875
4
"""Finding duplicate letters in a word.""" __author__ = "730319407" User_string: str = input('Enter a word:') count: int = 0 i: int = 0 result: bool = False while i < len(User_string): x = i + 1 while x < len(User_string): if User_string[i] == User_string[x]: result = True x += 1...
94ecd127e48b1005010906d82e6f6f72fd6eb702
AntonAroche/DataStructures-Algorithms
/arrays/remove-duplicates.py
856
3.765625
4
# Given a sorted array nums, remove the duplicates in-place such that each element # appears only once and returns the new length. Do not allocate extra space # for another array, you must do this by modifying the input array in-place with O(1) extra memory. def removeDuplicates(nums): size = len(nums) idx =...
fea3eb8962250ac66a1d519c751f53e1f5119379
luthraG/ds-algo-war
/general-practice/11_09_2019/p6.py
1,163
3.9375
4
''' By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? ''' from timeit import default_timer as timer import math def prime_rwh(upper_limit, number): primes = [True]* upper_limit primes[0] = False primes[1] = False...
384fdefe028d1c8f714087ac013e75c3f8038716
matt0418/Data-Structures
/queue/queue.py
2,457
4.09375
4
class Node: def __init__(self, value = None, next_node = None): # the value at this linked list Node self.value = value # refernce tot he next node in the list self.next_node = next_node def get_value(self): return self.value def get_next(self): return self.next_node def set_next(self...
bf90b1026c3dac839e35a0446a498f03d87a4a96
wuggy-ianw/Project-Euler-py
/problem-0009.py
1,083
4.3125
4
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # a**2 + b**2 = c**2 # For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. from itertools import combinations from utils.generators import first...
5ba0d9bcdb7e7190fb32b62c507dfa2f75dd62b5
chongin12/Problem_Solving
/acmicpc.net/11966.py
76
3.546875
4
import math n=int(input()) if 2**int(math.log2(n))==n:print(1) else:print(0)
75da13397d080fac035891a136e815b836c07659
Caaaam/Canoe-Polo-Team-Generator-V2
/TeamGenerator.py
855
3.578125
4
# This is our main file import readfromcsv import playerclass import teammakerclass # Returns players dataframe from readfromcsv module players = readfromcsv.readplayers() #define playerlist to contain class instances of players playerlist = [] for row, val in players.iterrows(): playerlist.append...
bb32a6ff2284110025f78413c8de4dbb3f89d1cd
mikelitu/DSCUSB
/DSCUSBSensor.py
2,598
3.5
4
import ctypes class Sensor(): def __init__(self, COMPort): """ :param COMPort (int): The port where the DSCUSB is located in your computer This function loads the library containing the functions to establish an ASCII connection with the DSCUSB, and opens the port to st...
b9cae5cc0317174a10ebac44b39499bc607dc7ae
stevjain37/Profile
/headTails.py
532
3.578125
4
import numpy as np def coinFlip(p): result = np.random.binomial(1,p) #adds result to numpy array return result probability = .5 inquireFlips = input("How many flips?") n = int(inquireFlips) #initiate array fullResults = np.arange(n) for i in range(0,n): fullResults[i] = coinFlip(probability) i ...
24264b6d4e5222fb46e3cc7a3ec7f7cac1a6be88
smudugal/ValidPhoneNumber
/test_validphone.py
972
3.765625
4
import unittest import validphone class TestValidPhone(unittest.TestCase): @classmethod def setUpClass(cls): pass def test_valid_phone_num(self): num = "333-333-3333" self.assertTrue(validphone.telephone_check(num)) num = "(123)555-5555" self.assertTrue(validphone....
095cf9940781f4cab04e2ab7914c9ea700824632
mawande21/class-py
/main.py
588
4.125
4
class Bus: '''this class defines how a bus looks like''' count = 0 def __init__(self, driver, color,seats): self.driver= driver self.num_of_seats= seats self.color = color self.bus_count() def set_color(self,color): self.color = color def num_o...
e2a0fb395a65e624c80c58a54332550bc595e7aa
thirihsumyataung/Python_Tutorials
/function_box_rectangle.py
234
4.09375
4
def area_Box(length , width): area = length * width print("Area of the Box is : " + str(area)) area_Box(5,6.0) length = float(input("Length of the box : ")) width = float(input("Width of the box : ")) area_Box(length, width)
99be0a95548104762aae10dac062761d4baac436
Shanil98/haarCascade_Car-Pedestrian_detector
/Detection_Driving.py
1,421
3.5625
4
import cv2 # our image or video #img_file = 'dashCam.jpeg' vid = 'dashcam1.mp4' # our pre-trained car classifier and pre-trained pedestrian classififer car_tracker_file = 'car_detector.xml' pedestrian_tracker_file = 'haarcascade_fullbody.xml' # create opencv image, it reads the image to read it correctly #img = cv2....
74332f358b9fff9d954c0c0329d934c5868f692c
ashwinm2/Challenges
/subsequent_words_binary_add.py
628
3.78125
4
# Implementing the all subsequent words for given basestring # Binary Addition def compute(temp_lt, pointer): flag = 0 check_lt = [1 for x in temp_lt] if temp_lt[pointer] == 0: temp_lt[pointer] = 1 elif temp_lt == check_lt: pass else: temp_lt[pointer] = 0 temp_lt = compute(temp_lt, pointer - 1) return t...
210740ed5a634c7800f4a52ee49d9b081fab99b4
hydrahs/golden_mine
/exercise_1.py
234
4.0625
4
def myFunction(str): array = list(str) array_1 = array.reverse if (array==array_1): return True else: return False print(myFunction(str = "dsfasdf")) """ str.join(array.reverse) print(str) """
a8cb384dc0440a3f8ae962d3c543af8e179fa9cd
riteshelias/UMC
/ProgramFlow/guessgame.py
1,734
4.125
4
import random answer = random.randint(1, 10) print(answer) tries = 1 print() print("Lets play a guessing game, you can exit by pressing 0") guess = int(input("try count - {}. Please enter a number between 1 and 10: ".format(tries))) while guess != answer: if guess == 0: print("Bye, have a nice day!") ...
ceb4632cb6d2ddd46ac1c532f18a5e6fea6bc1fc
oreqizer/pv248
/12/frames.py
1,711
3.9375
4
import pandas as pd import math # The data for this exercise is in ‹frames.csv›. The data represents # grading of this very subject (with made-up names and numbers, of # course). The columns are names, number of points from weekly # exercises, from assignments and from reviews. Implement the # following functions: # ...
7320010cead35e71307e2da7aa6093e7a49d4503
ajgrinds/adventOfCode
/2020/day05.py
1,125
3.765625
4
# Advent Of Code 2020 Day 5 Answer # Code by: Andrew Grindstaff # https://adventofcode.com/2020/day/5 def main(): file = open("input.txt").read().splitlines() a = set() part_2 = 0 # Part 1: Converts the string of F, B, L and R to a binary number, then gets the decimal version - saves # it in a l...
400526da0cf90a4bae999cf9c503fa3b985f8fc0
pau1fang/learning_notes
/数据结构与算法/剑指offer_python语言/question36_二叉搜索树与双向链表.py
1,107
3.984375
4
class Node: def __init__(self, val): self.val = val self.left = None self.right = None def convert(root): last_node = [None] convert_node(root, last_node) head_of_list = last_node[0] while head_of_list is not None and head_of_list.left is not None: head_of_list = ...
4cf6cade9d4aefe4399ddbbd278290a0f2723c02
Ramune6110/Machine-learnig
/Logistic-Regression.py
4,668
3.625
4
#!/usr/bin/env python # coding: utf-8 # In[17]: # ニュートン法 import numpy as np import matplotlib.pyplot as plt class Newton: def __init__(self, n, w, lamda, iteration): # parameter self.n = n self.w = w self.lamda = lamda self.iteration = iteration ...
d2cd61433e3264f38f57ba81166f941a15f7b91e
pcomo24/DigitalCrafts-work
/part1ex5.py
201
4.03125
4
day = int(input('Day (0-6)? ')) #print({day}).format("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") if day == 0 or 6: print("Sleep in") else: print("Go to work")
5d38b8b3ce98f10d0c2bbb92ea808cfdee0277a4
daniel-reich/ubiquitous-fiesta
/CD5nkQ6ah9xayR3cJ_4.py
77
3.75
4
def add_odd_to_n(n): return sum([i for i in range(n + 1) if i % 2 != 0])
5e694a438d68a89d264bcbc8dcba06bc1aa4c6e8
Elixeus/BigData
/project/bigDataFinal.py
2,524
3.6875
4
from string import punctuation, maketrans import sys def eventWordCount(index, lines): ''' author: Xia Wang This function maps the candidates of each election cycle and return a tuple of (candidate name, media attitude). It first makes sure the encoding is utf-8 because there are characters like e...
15eda0a573fd5c355da02c34506a8e6cc7532fac
dwkang707/BOJ
/python3/(18238)BOJ.py
467
3.671875
4
input_data = input() location = int(ord('A')) time = 0 # ord 내장 함수는 ASCII code를 반환하는 함수 # abs(int(ord(i)) - location)는 시계방향 # abs(26 - abs(int(ord(i)) - location))는 반시계방향 for i in input_data: if abs(int(ord(i)) - location) < abs(26 - abs(int(ord(i)) - location)): time += abs(int(ord(i)) - location) els...
e02942eb84a9eadceec5b9d3faaf68693aabdb7b
AswiniSankar/pattern
/pattern1.py
731
3.5
4
''' * * * * * * * * * * ''' n=int(input()) for i in range(1,n+1): for j in range(i,n): print(end=" ") for k in range(1,i+1): print("*",end=" ") print("\r") ''' 1 1 2 1 2 3 1 2 3 4 ''' n=int(input()) for i in range(1,n+1): for j in range(i,n): print(end=" ") for k in range(1,i+1): prin...
c21881534c9c6fa6627404561cc57291bd261f8a
dvalp/coding-practice
/hackerrank/python_intro.py
522
4.21875
4
def print_to_N(): ''' The challenge was to write a function that could take a given integer and print all the numbers leading up to it without any spaces. Two interesting things are happening here. First, the '*' is unpacking the generator created by range and passing the elements individually. ...
52b28892a10c6c1e4ca943050dd5f2b5bc653ba3
luisalourenco/AdventOfCode2019
/24/part2.py
5,683
3.53125
4
import time def timer(func): def wrapper(*args, **kwargs): start = time.time() f = func(*args, **kwargs) print(f'The function ran for {time.time() - start} s') return f return wrapper def printMap(map, level = None, iteration = None, fileMode = True): if fileMode: file1 =...
097270984b4389d5dc12526d5977aa657a0e4528
UtkuAraal/Mini-Python-Projects
/Kayıt Ve Giriş/Arayüz.py
1,349
3.984375
4
from Kullanıcı import * app = App() def valudation(email): if email.find("@") != -1 and email.endswith(".com"): return True else: return False print("Welcome to our program!") while True: print("1- Login\n2- Register") choose = input("Your choose: ") if choose == "q": print...
1635448cfe9e94d5830a564d91047ceee4e1805b
JamesLawrence30/FinancialExploration
/mongoQuotesDB/oldVersions/firstVersion.py
1,154
3.625
4
import requests; import collections; """import json;""" alphaVantageKey = "0ZU6NM5CMUSMR7DO" def makeRequest(symbol): #create api call string below. receive time series from api request = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol="+symbol+"&outputsize=compact&datatype=json&apikey="+...
dfa37f5383aeb294e3729f44264d9020cd22d808
laippmiles/Leetcode
/20_有效的括号.py
1,469
3.875
4
''' 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。 有效字符串需满足: 1.左括号必须用相同类型的右括号闭合。 2.左括号必须以正确的顺序闭合。 注意空字符串可被认为是有效字符串。 示例 1: 输入: "()" 输出: true 示例 2: 输入: "()[]{}" 输出: true 示例 3: 输入: "(]" 输出: false 示例 4: 输入: "([)]" 输出: false 示例 5: 输入: "{[]}" 输出: true ''' class Solution(object): def isValid(self, s): ""...
5da053e7f13052d6790ecec2f497ada2d06ec4a0
quartox/AXA-Driver-Telemetrics
/loopTiming.py
890
4
4
"""Computes the estimate when a loop will be finished.""" __author__="Jesse Lord" __date__="March 14, 2015" import time def timeInit(): return time.time() def extrapolateEnd(inittime,totaliter,index): current = time.time() secperiter = (current-inittime)/float(index) remainingsec = (totaliter-index)...
d19778411d4451d09d3a9d53f7521731e4387e8f
sCAIwalker/InterviewPreparation
/TreeRepresentations.py
317
3.65625
4
#Regular Tree class Node(object): def __init__(self, data): self.data = data self.children = [] def add_child(self, obj): self.children.append(obj) #Binary Tree class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None
f490a789fca3e73effb87b210dec0145c8256316
sambapython/batch78
/log.py
976
3.90625
4
import logging logging.info("strt the program")# it's already configured the default basic Config. It will not consider # any config later #NOTE: what ever the basic config writing it, make sure that will execute before executing any log message. logging.basicConfig(level=logging.DEBUG, filename="log.txt", format="...
4f61b26e71cc54bd599364c19e9413227d7c6586
sagarnikam123/learnNPractice
/hackerEarth/practice/dataStructures/advancedDataStructures/suffixArrays/catsSubstrings.py
1,604
3.796875
4
# Cats Substrings ####################################################################################################################### # # There are two cats playing, and each of them has a set of strings consisted of lower case English letters. # The first cat has N strings, while the second one has M strings....
1b06ebb55b9210a3d863aadf9256a34098996f9e
drewplant-MIDS/W205
/exercise_2/scripts/histogram.py
2,284
3.65625
4
""" Python source code - search through postgresql table to find number of occurrences of particular word Usage: python histogram k1 k2 ========================= where: k1, k2 Bin limits for number of occurrences for words where k1 > k2 ...
14c9636420c5db250525c7ed26bfd380841300db
DanMayhem/project_euler
/058.py
1,620
4.0625
4
#!python """ Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interesting to note that the odd square...
ec0e131b746d2bd8093d91236ab43c7702bb7053
ZL4746/Basic-Python-Programming-Skill
/Second_Part/Practice_Assignment/01_Dice.py
1,285
3.796875
4
def graphy(list1): list2 = [] larggest = max(list1) for h in range(larggest): inlist = "|" for i in range (len(list1)): if list1[i] > 0: inlist += " *" list1[i] -= 1 else: inlist += " " list2.append(inli...
c98a38057b4e420cca442a17f501bf397926e0ae
s-kimmer/tesp2016
/demo/camcapture_demo.py
884
3.546875
4
from __future__ import print_function # with this, print behaves like python 3.x even if using python 2.x import cv2 camera_device_index = 1 #choose camera device [0,N-1], 0 for first device, 1 for second device etc. cap = cv2.VideoCapture(camera_device_index) if cap.isOpened(): # try to get the first frame print...
bbf8b432ddf101d3e6986c2a09695773abd47c98
JosevanyAmaral/Exercicios-de-Python-Resolvidos
/Exercícios/ex091.py
559
3.671875
4
from random import randint from time import sleep from operator import itemgetter jogadores = {'Jogador 1': randint(1, 6), 'Jogador 2': randint(1, 6), 'Jogador 3': randint(1, 6), 'Jogador 4': randint(1, 6)} ranking = list() print('Valores sorteados: ') for c, j in jogadores.items(): print(f' O {c} ti...
d127705f9dd239922fbb76363c5cc3ca519736c3
refeed/StrukturDataA
/meet1/F_max3Angka.py
549
3.65625
4
''' Max 3 angka Batas Run-time: 1 detik / test-case Batas Memori: 32 MB DESKRIPSI SOAL Buatlah program yang menerima 3 buah input nilai, outputkan nilai paling besar diantara ketiga input tersebut. PETUNJUK MASUKAN Input terdiri atas 3 angka dalam 1 baris PETUNJUK KELUARAN Outputkan angka terbesar dari 3 angka yan...
7737bc3a3753c7641c3d418ec6e0ba50c979c69a
DanMayhem/project_euler
/024.py
939
3.96875
4
#!python """ A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012 021 102 120 201 ...
e6a6567a742d646ffce0638931e93eac0bbe801d
bpotten7198/code-change-test
/greenBottles.py
466
3.96875
4
import time bottles=10 #Sets bottles to 10 for x in range(bottles,0,-1): #Creates a loop which loops 10 times print("{0} green bottles, hanging on the wall\n{0} green bottles, hanging on the wall".format(x)) #Prints out how many bottles there are print("And if 1 green bottle should accidently fall,\nThere'll b...
6a8c50c79564dbaf30b72f7f17641782c71b8e24
punyanishivam/Cracking-the-Coding-Interview
/2.2.py
226
3.6875
4
import Linked Lists def nthToLast(self, n): p1 = self.head p2 = self.head for i in range(n): if p1 is None: return p1 = p1.next while p1 is not None: p1 = p1.next p2 = p2.next return p2
21b5a20e826dbf86648762e4b7b4a7782369ec35
Ashleshk/Python-For-Everybody-Coursera
/Course-1-Programming-for-Everybody-Getting-Started-with-Python/Codes/compute_gross_pay_py3.py
185
3.859375
4
hrs = input('Enter Hours: ') hrs = float(hrs) hourly_rate = input('Enter Hourly Rate: ') hourly_rate = float(hourly_rate) gross_pay = hourly_rate * hrs print("Gross pay:", gross_pay)
e6efecc8e0521bfbe6519713f8d0b19410b43c76
keshavmusunuri/Isolation_Game_Agent
/my_custom_player.py
3,733
3.71875
4
from sample_players import DataPlayer import random class CustomPlayer(DataPlayer): """ Implement customized agent to play knight's Isolation """ def get_action(self, state): """ Employ an adversarial search technique to choose an action available in the current state calls self.queue.put(ACT...
0fc2f839ca636ef43f39f6174ff4f42c8a4c8daa
karim-aboelazm/PyCheckio_ScientificExpedition
/Striped Words/mission.py
939
4.09375
4
def checkio(line: str) -> str: Vowels = 'AEIOUY' Consonants = 'BCDFGHJKLMNPQRSTVWXZ' cont = 0 newline = '' for c in line: if c.upper() in Vowels: newline += 'a' elif c.upper() in Consonants: newline += 'b' elif not c.isalnum(): newline += '...
e3a0151735dbb748d5ce32b674e95bacdf73a09a
JinJianyuCSlover/MLBoBo
/Chapter6_GradientDescent/ML61a.py
1,157
3.875
4
import numpy as np import matplotlib.pyplot as plt plot_x = np.linspace(-1,6,141)#绘制的x点均匀取值 plot_y=(plot_x-2.5)**2-1#模拟损失函数 #绘制图像 # plt.plot(plot_x,plot_y) # plt.show() def dJ(theta): """导数""" return 2*(theta)-5 def J(theta): """损失函数""" try: return (theta-2.5)**2-1 except: return ...
7c119286b9eeadbfa532e9a016266fa9512b93b3
Chidinma-U/Personal_Tutorials
/dynamic.py
460
3.578125
4
import time stored_results = {} def sum_to_n (n): start_time = time.perf_counter() result = 0 for i in reversed (range(n)): if i + 1 in stored_results: print ('Stopping sum at %s because we have previously computed it' %str(i+1)) result += stored_results [i + 1] ...
1f39ae582667b7a12e07d832ea04b6643431fdb3
skanwat/python
/learnpython/fibonacciseries.py
218
3.625
4
def fibo(x): if x == 1: return 1 elif x == 0: return 0 else: return (fibo(x-1) + fibo(x-2)) list=[] for x in range(1,10): z=fibo(x) list.append(z) print(z)
4d869cbc3693ffcd8843a6f939cbc4f1daabcf48
renukadeshmukh/Leetcode_Solutions
/1072_FlipColumnsForMaximumNumberofEqualRows.py
1,959
4.3125
4
''' 1072. Flip Columns For Maximum Number of Equal Rows Given a matrix consisting of 0s and 1s, we may choose any number of columns in the matrix and flip every cell in that column. Flipping a cell changes the value of that cell from 0 to 1 or from 1 to 0. Return the maximum number of rows that have all values equ...
df53ce2d187cd33ea26398e5c5f4c1c8ba9d1782
ghxuan/leetcode
/py/calculate.py
1,761
3.796875
4
def calculate(s): """ :type s: str :rtype: int """ s = s.replace(' ', '') fix = postfix(s) print(fix) temp = [] sign = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '/': lambda x, y: x / y, '*': lambda x, y: x * y, '×': lambda x, y: x * y...
c1a508753c8441bbf76d4f6b9768e3b261b6e6f4
vishalkarda/DailyPracticeProblems
/October/06Oct2019_tree_at_height_h.py
695
3.890625
4
""" Given a binary tree, return all values given a certain height h. """ class Node: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right val = list() def values_at_height(root, height): if root is None: return None i...
99aef96df8226b8ecee48251e9aa270a05097fd9
theo-l/theo-l.github.io
/hacking_python_class_python_source/builtin_call_expression_demo.py
356
3.53125
4
class CallableInstanceClass: def __init__(self, name): print(f'calling class:<{self.__class__.__name__}>') self.name = name def __call__(self, *args, **kwargs): print(f'calling instance:<{self.name}>') if __name__ == '__main__': callable_instance = CallableInstanceClass('callable...
37e0f0c22fe9c50f30981ce55cb95992dc531c59
Mike1604/MIPS
/Proyecto_D13E02/Decodificador.py
11,709
3.625
4
#Decodificador import os, sys, subprocess from io import open def inicio(): os.system("cls") print("Bienvenido") print("Equipo 02") print("Fʟᴏʀᴇs Esᴛʀᴀᴅᴀ Aʙʀᴀʜᴀᴍ Mɪɢᴜᴇʟ Aɴɢᴇʟ") print("Guerra Lopez Paulina Estefania") print("Pᴇʀᴇᴢ ᴅᴇ ʟᴀ Tᴏʀʀᴇ Lᴇᴏɴᴀʀᴅᴏ Oᴄᴛᴀᴠɪᴏ\n") print("Este algoritmo resuelv...
ce923c095efc5afeb210150989cf4ca4dad36935
rmzturkmen/Python_assignments
/Assignment-13_1-Find-largest-number.py
234
4.1875
4
# Find Largest Number in a List with function, for and if. def max_num(lst): max = lst[0] for i in lst: if i > max: max = i else: return max lst = [-6, 8, 12, 5, 13, -4] print(max_num(lst))
84aa8557cd98423577a6b35b8e1747d09d693755
michakomo/aisd.py
/linked_list.py
1,851
3.890625
4
class LinkedList: def __init__(self): self.head = None class Node: def __init__(self, val = None, next = None): self.val = val self.next = next def __repr__(self): return str(self.val) def push(self, val): ### O(1) self.head = self....
0b36554bc801daff7196db982eb3a875343241a3
stefifm/trabajos-practicos-utn
/tp/2020_AED_TP3_Bruera_59149[1K10]_Tanchiva_82179[1K10]/funciones_participantes.py
10,989
3.640625
4
import random print("Para la carga de los participantes") #Aquí se encuentran las clases Participantes y Fixture class Participantes: def __init__(self, nom, conti, rank): self.nombre = nom self.continente = conti self.ranking = rank def to_string(participantes): """ ...
a9c81ba963c8a3c9426971edfc9ac3dfeac00d01
LeleCastanheira/cursoemvideo-python
/Exercicios/ex047.py
100
3.625
4
for n in range(2, 51, 2): print(n, end=' ') #end = é pra escrever um número do lado do outro
7f5f33b40f1a8d3acc72c889bef1accf9432abb7
rubenvdham/Project-Euler
/euler009/__main__.py
833
4.4375
4
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ def find_triplet_with_sum_of(number): sum = number number = int(number/2)...
359773269fee557d0a513abace1283ac871af2a9
BrickMyself/Python
/2020_5_24Test.py
2,193
3.921875
4
#任务一:设计一个 Circle 类来表示圆, # 这个类包含圆的半径以及求面积和周长的函数。 # 再 使用这个类创建半径为 1~10 的圆,并计算出相应的面积和周长。 # 运行结果如下: #半径为 1 的圆,面积: 3.14 周长: 6.28 # 半径为 2 的圆,面积: 12.57 周长: 12.57 # 半径为 3 的圆,面积: 28.27 周长: 18.85 # 半径为 4 的圆,面积: 50.27 周长: 25.13 # 半径为 5 的圆,面积: 78.54 周长: 31.42 # 半径为 6 的圆,面积: 113.10 周长: 37.70 # 半径为 7 的圆,面积: 153.94 周长: 43.98 # 半径为 8 的...
963ce62e914916093f6c07e47a1d63d5ce195dc2
stevengonsalvez/python_training
/04_ListsTuplesDictionariesAndSets/Exercises_SourceCode/primes_alt_D.py
1,872
3.890625
4
# -*- coding:utf-8; -*- '''A module providing some functions generating prime numbers.''' __author__ = 'Russel Winder' __date__ = '2013-03-03' __version__ = '1.1' __copyright__ = 'Copyright © 2012, 2013 Russel Winder' __licence__ = 'GNU Public Licence (GPL) v3' from math import sqrt class Prime(object): def _...
64ba84d0a6089267233573ee1d4edfe9d04128b1
timurridjanovic/data-structures
/graph/graph_depth_first.py
905
3.828125
4
### Not done #### graph = { 1: [2, 4], 2: [1, 3, 5], 3: [2, 11], 4: [1, 5, 7], 5: [2, 4, 6, 8], 6: [5, 9, 10], 7:[4, 13], 8: [5, 14], 9: [6, 12], 10: [6, 11], 11: [3, 10], 12: [9], 13: [7, 14], 14: [8, 13] } class Graph(object): def find_path(self, start, end, graph): open = [start] ...
a14474e5a769a60119b78ae772effd5b9d25343e
MohamedELfeky44/Tic-tac-toe
/Tic tac toe/Tic tac toe pygame.py
10,378
3.734375
4
import pygame pygame.init() #initiate pygame win = pygame.display.set_mode((800,550)) #set the window pygame.display.set_caption("Tic tac toe") # set title win.fill((255,255,255)) #set backgroud start_button = pygame.draw.rect(win,(250,200,100),(550,30,200,150)) result_board = pygame.draw.rect(win,(2...
dde19b935c765c4368f5c1970ea2b010247519ba
TwisterMike15/Python-Projects
/CarrolaGorseMarietta.py
944
4.09375
4
#Python Program 1- Compound Interest #Michael Gorse, Anthony Carrola, and Brittany Marietta #Prints out a description of what the program does for user print('This is a compound interest calculator. Enter the values for the variables') print('in the compund interest equation, and this will produce the result...
b4b27dfb0d7c88afd95ce1bda1c214a62191b7be
Jiaget/LeetCode-Python3
/并查集模板.py
886
3.828125
4
class DisjointSet: def __init__(self, length): self.father = {i: i for i in range(1, length + 1)} self.depth = 0 def add(self, x): # 添加一个节点,该节点父节点应该为空 if x not in self.father: self.father[x] = None def find(self, x): # 查找根节点 root = x whil...
cec0f9cf86a0a2f563b0dfe415fd5c97195d5749
Dan-Teles/URI_JUDGE
/1255 - Frequência de Letras.py
383
3.53125
4
for _ in range(int(input())): s = input().lower() res = "" l = [0] for letra in s: if letra.isalpha(): if s.count(letra) >= max(l): l.append(s.count(letra)) for letra in s: if s.count(letra) == max(l): if not letra in res: ...
10655a3b1d978fb5760af7ddeb8a8287a566e8ee
TimMunday/BootCamp2018
/ProbSets/Comp/Week1/PS_1/ComplexNumbertesting.py
1,549
3.59375
4
# -*- coding: utf-8 -*- """ Created on Thu Jun 21 14:29:19 2018 @author: Tim """ from object_oriented import ComplexNumber def test_ComplexNumber(): a=3 b=4 py_cnum, my_cnum = complex(a, b), ComplexNumber(a, b) #Validate the constructor if my_cnum.real != a or my_cnum.imag != b: prin...
3f28fc6d3b9ac9b6bbd109f1f9d2ceae5eec3b3b
jaydicine/Python
/POTW Sum of Digits.py
563
3.828125
4
total = 0 #function to sum digits of a number def digsum(number): number=str(number) sum=0 for i in range(0,len(number)): digit = number[i] sum += int(digit) return(sum) # loop function for all 3 digit integers for n in range(100,999): # check if sum is 5 ...
2c43eba9b426653ed42a69d751e1873b89b51976
chanyoonzhu/leetcode-python
/1482-Minimum_Number_of_Days_to_Make_m_Bouquets.py
1,765
3.640625
4
class Solution: """ - binary search + greedy - O(nlogK), O(1) - K is the largest bloom day """ def minDays(self, bloomDay: List[int], m: int, k: int) -> int: days = max(bloomDay) def binary_search(l, r): if l == r: return l mid = l + ...
e6b8dd911d626ecb9989f5e538b2df1fe7325975
aviadba/eureka_signalprocessing
/udemySignalProcessing.py
40,488
3.5
4
""" udemysignal - Udemy Signal Processing course root file - contains all the implemented signal processing classes. For GUI, use through udemysignal tabs classes and generic GUI framework """ import numpy as np import scipy.signal from scipy.interpolate import interp1d from scipy.signal import * #welch, spectrogram, ...