blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
1c3434b6e4f0afe997fdaac6aac6bf7f91fd6ecf
Sin-Yejun/PPS
/week2/6-4_신예준_20210713.py
449
3.625
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: li = [] curr = head while curr!= None: li.append(curr.v...
a2a80a0f18f0e075fb3962a4f2f256ea9f18b163
Melijah5/user
/user.py
1,320
3.796875
4
class user: # methods def __init__(self, username,email_address): self.name = username self.email = email_address self.account_balance =0 def make_deposit(self, amount): self.account_balance += amount def make_withdrow(self, amount): if self.account...
11b1be5a387a866c7069207cd88eb07427128eed
tielushko/The-Modern-Python-3-Bootcamp
/Section 29 - Testing with Python/tests.py
1,982
3.8125
4
import unittest from activities import eat, nap, is_funny """you can add documentation to each of the tests with """""" string. """ #in order to see all of the documentation, run the python file with an -v flag class ActivityTests(unittest.TestCase): def test_eat_healthy(self): """Eat should have a posi...
9205fe60a6eee4479dfe249406c1a1b22dfaed6c
zadrozny/algorithms
/Search/breadth_first.py
603
3.78125
4
#!/usr/bin/python2 # -*- coding: utf-8 -*- import os def breadth_first(siblings=[], generations=[]): ''' Perform a breadth-first search / walkthrough on a directory (containing only directories, no files). ''' if siblings == []: return generations else: generations.append([...
144d5a20f1986a00d4717f58a189792d4eacc027
AlexAbades/Python_courses
/3 - Python_Deep_Dive/Part 1_Functional Programming/3 - Numeric types/3 - Integers_Constructors and Bases - Coding/Integers_bases and constructors.py
5,896
4.40625
4
# An integer number is an object - an instance of the int class. # The int class provides multiple constructors (way to instantiate an instance) a = int(10) a = int(-10) a = 10 # Literal way # We can pass floats but we'll have to deal with data losses print("") a = int(10.9) print(a) # We can also pass ...
ae4907c7f23857f731692025c52c6ab640b21d2c
CrzRabbit/Python
/leetcode/0041_H_缺失的第一个正数.py
1,190
3.75
4
''' 给你一个未排序的整数数组 nums ,请你找出其中没有出现的最小的正整数。 进阶:你可以实现时间复杂度为 O(n) 并且只使用常数级别额外空间的解决方案吗? 示例 1: 输入:nums = [1,2,0] 输出:3 示例 2: 输入:nums = [3,4,-1,1] 输出:2 示例 3: 输入:nums = [7,8,9,11,12] 输出:1 提示: 0 <= nums.length <= 300 -231 <= nums[i] <= 231 - 1 ''' class Solution: def firstMissingPositive(self, nums) ...
b23566ff5a81f21dce53aaf22f65f8db3863a252
w61643/Transpeer
/class1.py
791
4.125
4
#print("1") from typing import get_args x = 3 #print(x-1) #print(type(x)) """object of type 'int' has no len()""" #print(len("x-1")) thislist = ["apple", "banana", "cherry"] #print(thislist) thislist = ["apple", "banana", "cherry"] #print(thislist[1]) thislist = ["apple", "banana", "cherry"] thislist[1] = "blackc...
5438eba34db9ae6cd94cabcc2ff3bc093ddcd721
danschaffer/aoc
/2015/day16.py
1,631
3.859375
4
#!/usr/bin/env python class AuntSue: def __init__(self): self.data = { 'children': 3, 'cats': 7, 'samoyeds': 2, 'pomeranians': 3, 'akitas': 0, 'vizslas': 0, 'goldfish': 5, 'trees': 3, 'cars': 2, ...
b131bf180c6588b255607abab0bc2023b96a6544
wwjholmes/leetcode
/42.trapping-rain-water.py
1,999
3.9375
4
# # @lc app=leetcode id=42 lang=python3 # # [42] Trapping Rain Water # # https://leetcode.com/problems/trapping-rain-water/description/ # # algorithms # Hard (51.17%) # Likes: 10301 # Dislikes: 155 # Total Accepted: 694.7K # Total Submissions: 1.4M # Testcase Example: '[0,1,0,2,1,0,1,3,2,1,2,1]' # # Given n non-...
a85eac1e74fb23fc1950764c99ad2f92e2928bc9
pusparajvelmurugan/Guvi
/guvi/minimal_dist.py
155
3.671875
4
n=int(input("Enter the N value:")) a=[] b=[] for x in range(n): k=input() a.append(k) for x in a: for y in x: if y!=' ': b.append(y) print(min(b))
7f01da579695612235c48c923934c11d7c75a987
Arielkra/Python-HW
/עבודת הגשה מס 3/אילן/HW3_312201619.py
2,080
3.71875
4
''' ilan tal 312201619 ''' print ("Q1") ''' Q1 a (1, 2, 3, 4, 5) b (7, 8, 9) c (4, 6, 8) d (8, 7, 6, 5, 4, 3, 2) e (1, 2, 8, 9) f (5, 6, 7, 8, 9, 1, 2, 3, 4) have a array and print the requerments ''' a=(1,2,3,4,5,6,7,8,9) print("a") ''' 0 to 4 place ''' array1=a[0:5] print(array1) print("b") ''' 3 last nubers ''' arra...
6d6c5d6aefff328113c03c66777e88ba204a15e5
mkhai9x/comp3331
/ass/OLD_WORKING/utility.py
3,103
3.6875
4
''' # Python 3 # Author: z5147986 ''' def authenticate(credential): if len(credential) < 2 or len(credential) > 2: return 'Invalid Username. Please try again!' credentials = 'credentials.txt' with open(credentials, 'r') as reader: line = reader.readline() while line != '': # EOF ...
d940bbcbb6c01d897865e5d82f125c7e009dfdbe
abhin4v/jywrapper
/Lib/person.py
2,179
3.609375
4
class Employee(): def __init__(self, first_name, last_name): self._first_name = first_name self._last_name = last_name self._dependents = set() @property def first_name(self): return self._first_name @property def last_name(self): ret...
1d4f9eee9c21f9f22512c17ec03b84b6b14d805c
Liu-1120/Python
/pythonExercise/FluentPython_Code/Chap2/slice.py
240
3.65625
4
#!/usr/bin/env python3 # coding:utf-8 '''Chap 2 切片:list, tuple, str 都支持切片操作. ''' l = list(range(10)) print(l) l[2:5] = [20, 30] print(l) del l[5:7] print(l) l[3::2] = [11, 22] print(l) l[2:5] = [100] print(l)
26b38216b08cde852a1887bc257b32404adbbd66
Agheb/udacity-dand
/project01/Task3.py
2,478
4.1875
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv import re with open("texts.csv", "r") as f: reader = csv.reader(f) texts = list(reader) with open("calls.csv", "r") as f: reader = csv.reader(f) calls = list(reader) """ TASK 3: (080) is the area cod...
d14d985aad44cda0cf288ef1fb0191edb61be7ce
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4160/codes/1674_1105.py
780
3.78125
4
# Teste seu código aos poucos. Não teste tudo no final, pois fica mais difícil de identificar erros. # Ao testar sua solução, não se limite ao caso de exemplo. Teste as diversas possibilidades de saída a = input("Casa: ") print("Entrada: ", a) x = "Casa: " if (a!= "lobo" and a!="leao" and a!="veado" and a!="dragao" an...
329b336cca9ddef4aebc9292a69b3ed86b594bf2
TomLXXVI/pypv
/pypv/lib/timer.py
574
3.734375
4
import time import threading class Timer(threading.Thread): def __init__(self): super().__init__() self._stop_event = threading.Event() def stop(self): self._stop_event.set() def is_stopped(self): return self._stop_event.is_set() def run(self): start_time = t...
e21a4e693f7a4232219886cf00ef49ad5dd2fc40
obulpathi/python
/syntax/exceptions/sample.py
259
3.5
4
class Error1(Exception): pass class Error2(Exception): pass def fun(x): if x == 1: raise Error1 if x == 2: raise Error2 print('trying try catch') try: # fun(1) fun(2) except Error1: print('hey got error1') except Error2: print('hey got error2')
cc205dfc1c9a91f356e2876b367c3fec8b4a6b40
kevin510610/Book_Python-Tensorflow_PoWen-Ko
/ch10-HTTP/04XML.py
1,328
3.75
4
#!/usr/bin/env python # -*- coding=utf-8 -*- from xml.etree import ElementTree import sys def print_node(node): print("==============================================") print("node.attrib:%s" % node.attrib) #if node.attrib.has_key("age") > 0 : try: print("node.attrib['age']:%s" % node.attrib['age...
345badd13cfc6bc3d0d20ba8686786f9df63c70c
HaoboChen1887/Purdue
/ece364/Lab09/practical2.py
580
3.5
4
import re def getNumberPattern(): return r"([01]\d{2}|2[0-4]\d|25[0-5])" def getLinkPattern(): return r"href=\"(?P<url>.+)\">(?P<text>.+)<\/a>" if __name__ == '__main__': pattern = getNumberPattern() m = re.search(pattern, "We can get less than 300 pieces, but more than 005") print(m.group(0)) ...
cd9506343cab8727b07d7e144b23af9a54a962bf
ziegler121/projectHub
/week1_algorithms_and_data_structures.py
2,458
4.4375
4
"""1. This simple program finds the count of digits present in an integral number and lists the digits present. """ num_int = int(input("Enter the integral number: ")) count = 0 digits_lst = list() while num_int != 0: digit = num_int % 10 digits_lst.append(str(digit)) num_int = num_int // 10 count += ...
6c7bad8e9d8accc66601440726f27a2b0393caa3
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_200/5104.py
693
3.5625
4
def getLastTidy(N): lastTidy = 0 for i in range(N + 1): # check if tidy digits = [] for c in str(i): digits.append(int(c)) isTidy = True highest = 0 for j in range(len(digits)): if digits[j] >= highest: highes...
510875cab12a6a271e905ca8b01205a511116533
vtemian/interviews-prep
/elements-of-programming-interviews/7.1-str-int.py
1,202
3.921875
4
def to_int(number: str) -> int: result = 0 order = 10 ** (len(number) - 1) is_negative = number[0] == '-' if is_negative: number = number[1:] order /= 10 for letter in number: result += (ord(letter) - ord('0')) * order order //= 10 return result if not is_negat...
14baa19ee986d25af04eefcc0a06e8d3dfcc7abf
calypsobronte/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/7-islower.py
149
3.875
4
#!/usr/bin/python3 def islower(c): letter = ord(c) if letter >= 97 and letter <= 127: return (True) else: return (False)
14aa2349bc4b04eee963d67ca6427f52b28081a1
miniyk2012/leetcode
/refractoring/chapter9/null_object_9_7/null_object_after.py
1,695
3.609375
4
import abc class Nullable(metaclass=abc.ABCMeta): @abc.abstractmethod def is_null(self): pass class PaymentHistory: def __init__(self, delinquent: int = 0): self._delinquent = delinquent def get_weeks_delinquent_in_last_year(self): return self._delinquent class Customer(Nu...
829a92584198becf16dc0f24698a8b29c080aa04
m-tanner/PacmanCoins
/src/pacman.py
1,289
4.28125
4
"""Uses input from a text file to create a board and move 'pacman' on it, collecting coins.""" from typing import List from src.board import Board from src.config_manager import ConfigManager from src.file_parser import FileParser __author__ = "Michael Tanner" __email__ = "tanner.mbt@gmail.com" def pacman(input_fil...
158bedc95ce6b5c63d0c027c468ce6c99f5eefb5
CarlosV9516/-EDD-Tarea1_201403654
/Lista_Enlazada.py
2,482
3.90625
4
import Nodo class Lista_Enlazada: def __init__(self): self.head = None def vacia(self): return self.head == None def agregar_Final(self, data): if not self.head: self.head = Nodo.node(data = data) return curr = self....
5c64431a782580a81258d99f1f5cbf77521bd905
fthorey/swiftler-simu
/sensors/wheelencoder.py
763
3.671875
4
#!/usr/bin/python # coding: utf-8 class WheelEncoder(object): """ The WheelEncoder class represents a generic class for wheel encoders """ def __init__(self, ticksPerRev_): # Store the number of ticks in a revolution (2pi) self._ticksPerRev = ticksPerRev_ # Store the current numbe...
36b3da95726fa7201dc5f7cf556066c0c1a634fb
Siusarna/Labs
/Лаб7.py
429
3.625
4
import random def matrix(n): g=[] for i in range(0,n): g.append(round(random.uniform(0,100),2)) print (g) return g n = int(input("n= ")) array=matrix(n) k = int(input("k= ")) counter=0 summ = 0 for i in array: if i > k: summ+=i counter+=1 arithmetic_mean=round(summ/counter,3)...
90ef39aa200d6d3f00deb53a102c56d0a081af9d
SmartDogHouse/SmartDogHouse-Software
/src/main/python/light_sensor.py
1,512
3.5625
4
from sensor_adc import SensorADC class LightSensor(SensorADC): """LightSensor, measures amount of light""" def __init__(self, pin_num, range_min=0, range_max=4000, average_converging_speed=1 / 2, threshold=3000): """constructor. :param pin_num: number pin that will read value, it has to be A...
3430979a5372dab874cde17e8028b1ed2e458d41
awesome-liuxiao/leetcodesolution
/859_buddyStrings.py
1,230
3.65625
4
class Solution: def buddyStrings(self, A: str, B: str) -> bool: A = list(A) B = list(B) # Edge cases if not A or not B or len(A) == 1: return False if len(A) != len(B): return False # Find indices where the ...
bd266f988f29fd8069ef5e9bab7d52a228ddac66
yshrimp/algorithm
/grammar/unit13.py
988
3.96875
4
# 13. if조건문으로 특정 조건일 때 코드 실행하기 # if 조건식: # 코드 코드에 들여쓰기를 해야함 x = 10 if x == 10: print('10입니다.') # 13.1.3 if 조건문에서 코드 생략하기 x = 10 if x == 10: pass # 나중에 작성할 코드를 표시할 때 주석으로 남기는 방식 # 13.2 if조건문과 들여쓰기 x = 10 if x == 10: print('x에 들어있는 숫자는') print('10입니다.') # if 조건문 뒤에 코드들은 같은 크기로 들여쓰기가 되어있어야함 # 13.3...
44ed06709eb0d4d1775a347d79ec13222f80a486
wensby/advent-of-code
/python/2019_04_1.py
952
3.640625
4
import sys import re same_adjacent = re.compile(r'([0-9])\1') def run(input): count = 0 password_range = list(map(int, input.split('-'))) password = password_range[0] while password <= password_range[1]: descending_digit_index = find_descending_digit_index(password) if descending_digit_index: pa...
8b2d1f15907a49261cfda484e453798e82913db8
akalezic/python
/Personal_Projects/even_num.py
263
4.125
4
""" File: even_num.py ----------------- Prints the first 100 even numbers backwards. """ def main(): # prints first 100 even numbers backwards for i in range(200): var = (200 - i) if var % 2 == 0: print(var) if __name__ == '__main__': main()
2c7737147ee95c5477ab6f9b83681199905ff5ae
jjack94/python-modules
/randomday-jj.py
338
4.09375
4
# James Jack # 2/19/21 # Problem 3: Use random.choice to select a day of the week from a list and print that day. import random # import module random days = ("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday") # list var of days print(random.choice(days)) # print using choice mo...
19aab3021bc108386ce94f2fe1bad8d008b40670
Quasyhumonoid/new-newb-test
/python/Game.py
1,713
4.125
4
secret_word = "giglioplex" guess = "" guess_count = 0 guess_out = False guess_limit = 8 while secret_word != guess and not(guess_out): guess = input("Enter your guess: ") guess_count += 1 if secret_word == guess: print("Good Job!") elif secret_word != guess and guess_limit - guess_count == 1: ...
a1d0060614322bc0ece87de2a469fb27434324a7
Meaha7/dsa
/recursion/non-adjacent-subsets/count.py
395
3.640625
4
def x(nums): n = len(nums) def dfs(i): if i >= n: return 1 return dfs(i + 2) + dfs(i + 1) return dfs(0) def y(nums): n = len(nums) def dfs(start): count = 1 for i in range(start, n): count += dfs(i + 2) return count return dfs...
bcb1f78ea9745338f000132424ad930d7f5aee13
chenyulin0719/leecode
/python/src/main/utils.py
1,102
3.875
4
class TreeNode(object): def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def add_left(self, val): self.left = TreeNode(val) def add_right(self, val): self.right = TreeNode(val) class ListNode: def __init__(s...
41bcaed93f705fd5fb4d267ed3ac0afbc8117cea
arthurtomas/Codes_git
/desafio059.py
823
4.03125
4
choose = 0 while choose != 5: n1 = int(input('Digite um número: ')) n2 = int(input('Digite outro número: ')) choose = int(input('O que voce deseja fazer?\n' '[1] Somar\n' '[2] Multiplicar\n' '[3] Maior\n' '[4] Digitar novos números\n' '[5] Sair\n:')) if ...
99b80f14c64451e8cb21f694e732a0fa2fd341ea
UnderGrounder96/mastering-python
/01. Data Types/1.DataTypes.py
598
3.671875
4
# 1) NUMBER - Integer students_count = 1000 # 2) NUMBER - Float students_count = 4.99 # 3) BOOLEAN is_published = False is_published = True 1 == 1 # True 1 > 2 # False # 4) STRING full_name = "Alain Afonso" print('Hello World') print('Hello \nWorld') print('Hello \tWorld') # 5) METHODS x = 3.5, y = 3 int(x) ...
03fbeee680da39d12f0a361fa878c8bb78fe5adc
shreyaspaliwal/Courier-Service
/project.py
998
3.9375
4
# Courier service parcels = list() def main(): print("Select an option:") print("1. Add") print("2. Search") print("3. Exit") try: option = int(input("Enter your choice:")) except: print("Enter 1 or 2 or 3") quit() opt(option) # areas = ['kothrud', 'katraj', 'vima...
8782e163de2a28ab77c73694a5ea7924265e68a9
EmmanuellaAlbuquerque/Curso-Em-Video
/Python Mundo3 - Estruturas Compostas/desafio - 74.py
590
3.859375
4
from random import randint tuplaNume = (randint(0, 10), randint(0, 10), randint(0, 10), randint(0, 10), randint(0, 10)) # for numero in tuplaNume: #print(f'{numero}', end=' ') print(f'\nOu NÚMEROS GERADOS: {tuplaNume}\n') # Menor valor da Tupla print(f'O MAIOR valor da TUPLA é: {max(tuplaNume)}') # Maior...
ab1557ca370b4623316a8c7933a9f8bf261f6536
makrandp/python-practice
/LeetCode/Solved/Medium/AllNodesDistanceKInBinaryTree.py
2,328
4
4
''' 863. All Nodes Distance K in Binary Tree We are given a binary tree (with root node root), a target node, and an integer value K. Return a list of the values of all nodes that have a distance K from the target node. The answer can be returned in any order. Example 1: Input: root = [3,5,1,6,2,0,8,null,null,7...
ac415af059821c6c2e2f8b2d22ca32ca090d0465
2226171237/Algorithmpractice
/华为题库/二进制求和.py
1,460
3.625
4
''' 给你两个二进制字符串,返回它们的和(用二进制表示)。 输入为 非空 字符串且只包含数字 1 和 0。 示例 1: 输入: a = "11", b = "1" 输出: "100" 示例 2: 输入: a = "1010", b = "1011" 输出: "10101"   提示: 每个字符串仅由字符 '0' 或 '1' 组成。 1 <= a.length, b.length <= 10^4 字符串如果不是 "0" ,就都不含前导零。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/add-binary 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出...
2d02eee2c9682268143ff114d0ffcb5c4c037bf7
18516264210/MachineLearning
/python03/Yunsuanfu.py
1,086
4
4
class Yunsuanfu(object): ''' 我是文档的注释,我是否可以通过方法获取到呢 重写object 的方法,类似于java中的方式 ''' def __init__(self,name,age): ''' 我是方法注释 :param name: :param age: ''' self.name = name if isinstance(age,int): self.age = age else: ...
d351546bf3f9dd8809c9c90984709950ff086d5c
suyundukov/LIFAP1
/TD/TD6/Code/Python/5.py
243
3.5625
4
#!/usr/bin/python # Calculer la somme des valeurs du tableau def somme_tab(tab): somme = 0 for i in range(len(tab)): somme += tab[i] return somme tab = [5, 18.5, 13.2, 8.75, 2, 15, 13.5, 6, 17] print(somme_tab(tab))
3ad2ba815b9f23403773697a5680a99202b6d4ff
Mohsen-Kalantar/Day1PMClasses
/Point_5.py
1,684
3.890625
4
class Point: __counter=0 # A class attribute def __init__(self, vx, vy): self.__x=vx # attribute x is defined here self.__y=vy # attribute y is defined here Point.__counter += 1 def __del__(self): Point.__counter -= 1 def __str__(self): return f"<{sel...
97c8ad2bce39a95169b0ea734bf67449edfdc03a
wpine215/leetcode20
/easy/strings/valid_palindrome.py
2,002
4.03125
4
""" https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Lessons learned: - Always account for edge cases if index exceeds lis...
5314f6757eb80adca60a84acd09c773ff38e7ad2
EricTBKelley/Baccarat
/cards.py
860
3.59375
4
class Card(object): def __init__(self, suit, number): self.suit = suit self.number = number if number == "Ace": self.type = "number" self.value = 1 self.id = 14 elif number == "Jack": self.type = "face" self.value = 0 ...
606690f41406413a3b5d313c42f6ed4d463b5151
walliski/adventofcode-2020
/6/main.py
818
3.59375
4
with open('input.txt', 'r') as content: lines = content.readlines() charCount = {} answerCounts = 0 groupCount = 0 everyoneCount = 0 for line in lines: if line.isspace(): # Calculate Step 1 sum answerCounts += len(charCount.keys()) # Calculate step 2 count for cCount in charCo...
44f4f5287fcfd4b456cad36ab4f2bc215a41427d
Johnspeanut/Computer_science_fundation_course
/Homeworks/HW6/recipes.py
5,844
4.0625
4
""" Student name:Qiong Peng NUID: 001559637 CS5001 Section 4, Fall 2020 Instructor: Dr.Abi Evans and Andrew Jelani Home work 6 Problem 2:recipes.py Program description: The program is to enable users to save and read recipes. """ def write_recipe_to_file(name_recipe, ingredient, time, direction): ''' Function...
0e708c0a6c5a3233eb037a7fb0cc65ba4b9db04f
surajsinghIT/python-game
/snake water gun game project-1.py
997
3.921875
4
#projecr-1 #snake water gun game or rock paper scissor def gam(comp,you): if comp==you: return None if comp=="s": if you=="w": return False elif you=="g": return True elif comp=="w": if you=="g": return False ...
4e48d398bfd6a8d1b06b9b65316d99281ac90007
fplucas/exercicios-python
/estrutura-de-decisao/19.py
723
3.921875
4
numero = int(input('Entre com um número inteiro menor que 1000: ')) if(numero >= 1000): print('O número deve ser menor que 1000!') exit() centenas = numero // 100 resto_centenas = numero % 100 dezenas = resto_centenas // 10 unidades = resto_centenas % 10 if(centenas == 1): texto_centenas = '{} centena'.f...
b81340ef8b91a1ef7a0a10b749e30888d4db61b8
yiyi1026/projecteuler_ruby
/leetcode/pythonSolutions/74.search_a_2d_matrix.py
1,917
4.0625
4
''' 74. Search a 2D Matrix Medium Share Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each row is greater than the last integer of the previous row. Example 1: Input: matrix...
eac8fa4f89c8ed4a635ddd89d7d4449fa552df24
krndev07/Kiran-Dev
/sum_array.py
223
3.84375
4
def sum(arr): sum=0 for i in range(0,len(arr)): sum=sum+arr[i] print(sum) n=int(input("enter the no of element: ")) arr=[] for i in range(0,n): ele=int(input()) arr.append(ele) sum(arr)
47b7fbe7ca02b3b6799e7016b532cb3d603237b3
IgorRusskikh/russkikh200-mail.ru
/RenameFile.py
847
4.09375
4
import os def RenameFile(): try: File = input("Введите имя существующего файла: ") FileLocation = input("Введите место хранения файла: ") NewFileName = input("Введите новое имя...
77f97e565fe10c261b9c6f64d7fd24fb3b42c57e
miradouro/CursoEmVideo-Python
/aula014 - REPETIÇÃO WHILE/ex058-JogodeAdvinhacao.py
719
3.65625
4
from random import randint from time import sleep print('\033[1;33m-=-\033[m'*20) print('\033[1;34mVou pensar em um numero entra 0 e 10. Tente advinhar...\033[m') print('\033[1;33m-=-\033[m'*20) computador = 30 jogador = 20 contador = 0 while computador != jogador: jogador = int(input('Em qual numero pensei? ')) ...
8d7d1757aee30ffca3dbde9f20b3399e317db498
SamyMe/caisseEnreg
/catalogue.py
3,285
3.640625
4
class Catalogue(object): def __init__(self, prix_file, remises_file): self.prix_file = prix_file self.remises_file = remises_file self.prix = {} self.remises = {} self._lire_prix() self._lire_remises() def get_dicts(self): """ Retourne l...
6fc808cacdc0dddc3de410014be83e2af888d62e
JonRivera/DS-Unit-3-Sprint-2-SQL-and-Databases
/Study_Guide_Resources/Queries_Rpg.py
3,206
4.125
4
# This directory contains a file rpg_db.sqlite3, a database for a hypothetical webapp role-playing game. # This test data has dozens-to-hundreds of randomly generated characters across the base classes # (Fighter, Mage, Cleric, and Thief) as well as a few Necromancers. Also generated are Items, Weapons, and # connectio...
df115f905aef8302a29dec615e8dd060caaa14d3
wbogocki/Advent-of-Code-2020
/day 1/part2.py
709
3.890625
4
file = open("day 1/input.txt") expenses = [int(line) for line in file.readlines()] def search(expenses): for first_num in expenses: for second_num in expenses: for third_num in expenses: if ( first_num != second_num != third_num and firs...
865a6680fad791fe654f5556a948a499a0a63fbf
ariezzz/algoritms
/lesson3/task2.py
761
4.21875
4
# 2. Во втором массиве сохранить индексы четных элементов первого массива. # Например, если дан массив со значениями 8, 3, 15, 6, 4, 2, то во второй # массив надо заполнить значениями 0, 3, 4, 5 (индексация начинается с нуля), # т.к. именно в этих позициях первого массива стоят четные числа. import random f_list = [r...
a42d6945c09aa79cd98fe8f4c789e94da51738a0
hongfu12321/Leetcode
/Microsoft/microsoft_online_assessment/1647-Minimum_Deletions_to_Make_Character_Frequencies_Unique.py
1,387
3.671875
4
''' 1647. Minimum Deletions to Make Character Frequencies Unique Medium A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The frequency of a character in a string is the numb...
dfa389fb42cc7167f63c8f2e953d10c78cbb0c92
FredVB1/beautiful-prints-python
/beautiful_prints.py
4,754
4.5
4
def beautifulPrint(nestedData: any, maxItemsPerLine: int = 5, indent: int = 4): """ Outputs your passed [nestedData] in a beautiful way. The Concept ist that if an item of the nested data is a nested data type or the length of the nested data is bigger than the maximum items per line [maxItem...
05fdce3f8b86fa3cbabffc454aae40365e1bf522
gffryclrk/ThinkPython2e
/ch8/exercise8.7.py
187
3.9375
4
def counter(string, letter): count = 0 for char in string: if letter == char: count += 1 return count print('Number of \'l\'s in \'hello\': ', counter('hello', 'l'))
3b3966e3d588496a2136f08101961650ba0ec71e
GoetheLee/WebCrawlerStudy
/newscrawler/recon_crawleddata.py
698
3.875
4
""" 텍스트 정제 모듈 영어, 특수기호 모두 제거 """ import re # 입,출력 파일명 INPUT_FILE_NAME = 'output.txt' OUTPUT_FILE_NAME = 'output_cleand.txt' # 클리닝 함수 def clean_text(text): cleaned_text = re.sub('[a-zA-Z]', '', text) cleaned_text = re.sub('[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]', '', cl...
8e5a949a30b416e2b5aafb0fb4852be0a4977bca
januarytw/Python_auto
/class_0614/作业_0614_1.py
3,976
3.6875
4
# 1:利用6-12号写的excel数据读取类以及6月9号写的HTTP单元测试类,完成老黄历的单元测试,且输出测试报告。 # (注意是要从Excel里面获取测试 数据哦~并且把测试结果写回到Excel中去。请注意听老师上课的讲解题意。) '''一、HTTP请求类 ,分别完成GET和POST请求''' import requests class HttpRequest(): def __init__(self,url,data=None):#空用None self.url=url self.data=data def get_post_request(self,method): ...
f7f3a8ac110af843890b84258b6b12907d74e0a0
CDC24/unit4
/stringUnion.py
324
4.0625
4
#Caleb Callaway #3/28/18 #stringUnion.py - blends two words def stringUnion(word1,word2): twoword=(word1+word2) newword=("") for ch in twoword: if ch.lower() not in newword.lower(): newword +=(ch.lower()) return(newword) print(stringUnion("Mississippi","Pe...
e7ad0240a670137974b5d285f406eadab782fab4
jmarin20/jmarin20
/ejercicio16.py
344
4.125
4
lista = [] numero=0 while (numero%2 == 0): numero = int(input("ingrese un Numero: ")) if (numero%2 == 0): lista.append(numero) menor = min(lista) mayor = max(lista) print(f"El numero mayor es: {mayor}") print(f"El numero menor es: {menor}") else: print("Usted ...
3530e9b6a9eb4e6b65cbf0cb69f7e236703fefff
Thingee/urandom
/python/math/floor.py
641
3.578125
4
import math import time value = int(10) unit = 60 capacity = unit now = time.time() water_level = 0 request_value = float(capacity) / float(value) last_request = None #----------------------------------- if last_request is None: last_request = now leak_value = now - last_request water_level -= leak_value water...
110e52e1dbbdfba19691c290e2f505be9581dd14
syurskyi/Python_Topics
/125_algorithms/_exercises/templates/_algorithms_challenges/leetcode/LeetCode_with_solution/653 Two Sum IV - Input is a BST.py
1,095
3.90625
4
#!/usr/bin/python3 """ Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 9 Output: True Example 2: Input: 5 / \ 3 6 / \ \ 2 4 7 ...
7c4da2e9888a7e3d0191f35d4f24b6c5054bfd02
VictorCubas/Group-Tours
/EmpleadoExterno.py
1,118
3.84375
4
#!/usr/bin/env python from Empleado import Empleado class EmpleadoExterno(Empleado): ''' Clase que representa al empleado que se encuentra fuera de la empresa y que cobra por comision dado un porcentaje de sus ventas ''' cantidad_total_empleados_externos = 0 def __init__(self, nombre, apellido, cedula, fecha...
4458f54050c820c56421fe4b637a133c223c2bbe
FoConrad/ScrabbleHelper
/scrabble_helper/board.py
8,104
3.671875
4
""" This class defines an immutable scrabble board. This includes marked "special" squares, and letter played to the board. This board is ignorant of to which player the pieces belongs. """ import enum import unittest import itertools from collections import defaultdict, namedtuple BOARD_SIDE = 15 Piece = ...
a4c4262549a7d1f00fddfc1062839af14cbf8678
alcevik/LOTR
/game.py
7,293
3.65625
4
from sys import exit from sys import argv from random import randint from textwrap import dedent lord_of_the_rings, middle_earth, fellowship_of_the_ring, song = argv # a list of items fellowship_of_the_ring = ['Aragorn', 'Boromir', 'Gimli', 'Legolas', 'Hobbits', 'Gandalf'] # Scenes: Ruins, shire, rivendell, Journey,...
b649fcbe84390311c63776466851fd3e019b712e
robertpopescu97/PC
/Teme/Tema 1/ex2.py
156
3.875
4
numar = input('Introduceti un numar de la tastarura:') if int(numar) % 2 == 0: print(f'{numar} este PAR') else: print(f'{numar} este IMPAR')
1f20f31cef2de48df91960be3d084e0365b91964
Dipson7/LabExercise
/Lab3/question_no_1.py
389
4.4375
4
''' WAP to find the max of three numbers ''' def max(): a = int(input("Enter any number: ")) b = int(input("Enter any number: ")) c = int(input("Enter any number: ")) if a > b and a > c: print (f'{a} is the max of three') elif b > a and b > c: print (f'{b} is the max of three') e...
9e1daf7388c2231a4900d5a226b0ef048e4df778
ValentinaSoldatova/Data_Science
/Алгоритмы и структуры данных на Python./2/GeekBrains_lessons_2.py
2,970
3.515625
4
from pycallgraph import PyCallGraph from pycallgraph.output import GraphvizOutput graphviz = GraphvizOutput() graphviz.output_file = 'lesson_2.png' with PyCallGraph(output=graphviz): #1 print("Задание 1") print("Ноль в качестве знака операции завершит работу программы") while True: s = input("Зн...
2ed88c38c4e51ad8b3e36a1a76c136311713a83b
bhusalashish/DSA-1
/Data/Arrays/Missing Element/Sorting.py
442
3.984375
4
''' #### Name: Missing Element Link: [link]() #### Sub_question_name: Sorting Link: [link]() - Sort both arrays - Iterate using zip - Index where element from both the array is not same is the missing element **TC: O(nlogn + nlogn + n) ** ''' def find_missing(arr1, arr2): arr1.sort() arr2.sort() ...
1060c0df86e9f437ffc9ce121dcf2a850286cff7
mjurk456/100days
/9 Multiline input.py
636
3.984375
4
""" 100 DAYS OF PROGRAMMING CHALLENGE +++++++ DAY 9 ++++++++ Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized. Suppose the following input is supplied to the program: Hello world Practice makes perfect Then, the output should be: HELLO ...
81cb7c5aecd79926eaee82487c25455656cf9046
TomiNubi/crypton
/Crypton.py
9,250
4.5
4
# Name: Crypton # Date: 4/8/2017 # Purpose of this program is to source input from the user and either encrypt or decrypt it based on the user's choice. Text = input("Please enter your text") # The user writes the text he/she wants to encrypt or decrypt. choice = input("Type 'e' to encrypt 'd' to decrypt or 'q' to q...
0773a12eaeb8daeddaf657612ef9443e9c94d25b
agutek1995/kata_zadanka
/kata/tribonacci.py
285
4.15625
4
def tribonacci(signature, n): #your code here if n<3: signature=signature[:n] return signature else: for i in range(n-3): signature.append(signature[-1]+signature[-2]+signature[-3]) return signature print (tribonacci([1,1,1],10))
05c03c042bf138611ce5723180118e75b6d8a5a5
Durgesh15/python-
/class and instances/emp3.py
577
3.859375
4
class Employee: no_of_emp=0 raise_amount=1.04 def __init__(self,fname,lname,pay): self.fname=fname self.lname=lname self.pay=pay self.email=fname+'.'+lname+'@gmail.com' Employee.no_of_emp+=1 def fullname(self): return '{} {}'.format(self.fname,self.lname) def apply_raise(self): self.pay=int(self.p...
e465942a9955748cd847eb32a70bff956bcf889e
TriptSharma/Knots-AI
/audio_stream.py
449
3.578125
4
import speech_recognition as sr FILENAME = "audio_file.wav" r = sr.Recognizer() mic = sr.Microphone() with mic as source: print('Recording...') r.adjust_for_ambient_noise(source) audio = r.listen(source) # if keyboard.is_pressed('enter'): # print('Recording Complete') # break prin...
f633b533ffec8df903f67d960c217d5aa8fd8e50
adi1103sh/Self-made-random.randint
/Self_random.randint().py
2,258
3.796875
4
import datetime import sys '''USED CURRENT TIME CONCEPT TO GENERATE DIFFERENT NUMBERS JUS AS random>randint() DOES WITHOUT USING random MODULE''' def apna_rndm(mn,mx): l=[] for j in range(mn,mx+1): l.append(j) if (mn == mx) : print('The number is:') print(mn) sys.exit() #...
b4e6a2528c6c919f80cbc4444693a72644f7b7d9
kschwarz1116/Python-Cohort-Analysis
/src/read_orders.py
1,089
3.625
4
""" Imports the list of orders """ import csv import datetime as dt from customer import CUSTOMERS def read_orders(order_file: str, customers: CUSTOMERS) -> None: """ Reads in the orders file, modifying the CUSTOMERS Dict """ with open(order_file, newline='') as csvfile: csv_reader = csv.rea...
6e6c435c942a8c66c5171b8a64fa8d1cebd8fdce
vinaykl/Niche-EnterpriseProject
/general.py
955
3.515625
4
from bs4 import BeautifulSoup import urllib2, re import xlwt import requests url= 'https://colleges.niche.com/stanford-university/' page = urllib2.urlopen(url) soup = BeautifulSoup(page.read(),"lxml") general = soup.find("section",{"class":re.compile("block--two")}) # School type, Athlectic division , Athletic conf...
0cbd5a7ce4bcbdf8fde4ccc185bfd3676f368854
ipodlipnova/Internship
/TestTasks/3task.py
879
3.59375
4
import requests import json # this method is used to find 5 the most repositories by key words def search_popular_repos(keywords): keywords.replace(" ", "+") # creating url of request with given key words url = 'https://api.github.com/search/repositories?q=' + keywords + '&sort=stars&order=desc' ...
b5f8d9125517bd9f04706d7bb186456561667f4c
Bklyn/adventofcode
/2017/16.py
2,893
4.03125
4
#!/usr/bin/env python3 '''--- Day 16: Permutation Promenade --- You come upon a very unusual sight; a group of programs here appear to be dancing. There are sixteen programs in total, named a through p. They start by standing in a line: a stands in position 0, b stands in position 1, and so on until p, which stands i...
778916b72582976530b28dbaee30a51cfc0f245d
derek-is-the-best/AE401-Python
/for loop.py
373
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 13 15:11:20 2020 @author: juliapao """ import turtle Tur = turtle.Turtle() Turt = turtle.Turtle() Turt.color("pink") Tur.color("yellow") Tur.shape("turtle") import time for i in range(12): Tur.forward(30) Tur.right(30) Turt.backward(30)...
c365f42bf2d0fa7af3c0165c1afcaf9a0a69e22e
kangah-codes/fade
/fading.py
1,990
3.875
4
__author__ = "Joshua Akangah" import pygame #screen = pygame.display.set_mode((600, 500)) pygame.init() class FadingText(): def __init__(self, text, color, size, fadespeed): """ params: text: Text to render color: Color to render text in RGB format size: Size o...
81c5ca960b24a743704b0d098ce9107b4e7d012b
Aravinthanucep/Python-program
/prime.py
660
4.03125
4
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: Aravinthan # # Created: 30/01/2018 # Copyright: (c) Aravinthan 2018 # Licence: <your licence> #---------------------------------------------------------------------------...
aa3876954b4404a74703a73b13aa79c17dfb7054
stevestar888/leetcode-problems
/383-ransom_note.py
656
3.546875
4
""" https://leetcode.com/problems/ransom-note/ Runtime: 68 ms, faster than 53.97% of Python online submissions for Ransom Note. Memory Usage: 13 MB, less than 47.96% of Python online submissions for Ransom Note. """ class Solution(object): def canConstruct(self, ransomNote, magazine): """ :type ra...
95ba9bb96a7a4d8db38cb75e17ad0199f763fb2d
lidiyam/algorithms
/graphs/flower_painting_with_no_adjacent.py
688
3.671875
4
# 1042. Flower Planting With No Adjacent class Solution(object): def gardenNoAdj(self, N, paths): """ :type N: int :type paths: List[List[int]] :rtype: List[int] """ if not paths: return [1]*N graph = collections.defaultdict(set) for u, v in paths: ...
43622193ad1e75acb86555d6d1111eb1cb712c1b
CalamariDude/gradML
/assignment-00-CalamariDude/hw00.py
1,129
3.765625
4
def hw00(): ''' Assignment 00 for Foundations of Machine Learning, Fall 2019 Provide information on your background in programming, python, git, and machine learning. Provide insight into what you are hoping to learn in this class this semester. Submit your assignment as described in class by pushing to gith...
6d7b7067fc471b1ab70218c3b1e9d692f22a7f4c
oksydaza/python
/zad5.py
2,760
3.828125
4
TEXTFILE = "input.txt" WORD_LENGTH = 5 MAX_COUNT = 20 def get_text(input_file): with open(input_file, 'r', encoding='utf-8') as f: data = f.read() return(data) def split_text(input_file): input_file_splited = input_file.split() return(input_file_splited) def delete_short_words(input_array, le...
958c2078e6529b8241af13f8cd382840dd537e98
prazors/Python
/is_lower.py
109
4.0625
4
def is_lower(ch): for letter in ch == string.lowercase: print letter return -1
5bf86f0f247c19ed914d27b3eaaa352e2657df1b
richardson75/Python_TheHardWay
/ex19.py
368
3.671875
4
def cheese_and_crackers(cheese_count, boxes_of_crackers): print "you have %d cheeses!" % cheese_count print "you have %d boxes of crackers" % boxes_of_crackers print "man that is enough for the party" print "get a blanket.\n" cheese = int(raw_input("enter cheese count:")) print "We can give the funtion the nu...
15672cfc17afba64e794579cddcda6e86772bf04
johnsenaakoto/google_foobar_challenge_lvl2
/dont_get_volunteered_solution.py
3,424
3.71875
4
# Finds the shortest distance between two tiles def solution(src, dest): board = buildCheesboard() graph_board = buildGraph(board) vertices = len(graph_board) return(ShortestDistance(graph_board, src, dest, vertices)) # Builds chessboard def buildCheesboard(): board = [[0 for _ in range(8)]...
eadc119c33606732abf2bf1685961565e0cde316
VestigesH/GH
/python/59.画椭圆.py
438
3.953125
4
import turtle turtle.screensize() turtle.pensize() turtle.pencolor("black") turtle.setheading(90) primespeed= 1 for k in range(2): # 将相同的动作重复做一遍 for j in range(60): if j < 30: primespeed += 0.2 #加快画笔速度 else: primespeed -= 0.2 #减慢画笔速度 turtle.fo...
3495e88d5f0da71ece076233cd0bbc9dfae52894
yangyang5214/note
/bricks/904.py
949
3.5
4
# -*- coding: utf-8 -*- from typing import List def totalFruit(tree: List[int]) -> int: length = len(tree) r = 0 for i in range(length): for j in range(i, length): sub_tree = tree[i:j + 1] arr = set(sub_tree) if len(arr) <= 2: if len(sub_tree) > ...
daab735998b0d89503368db21925860ab6d10710
salhasalman/Authorship_Attribution
/bow_3authors.py
581
3.5
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 15 12:09:35 2018 @author: mgungor """ import pandas as pd from sklearn.feature_extraction.text import CountVectorizer train_txt = pd.read_csv('train.csv') test_txt = pd.read_csv('test.csv') vec = CountVectorizer() train_bow = vec.fit_transform(train_txt["...