blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
11c4dada4b26e5c2676ea0c1bee1f261c42da6f2
zhangyudong0215/Learning
/self_learning_projects/py3/somethingelse/24piints.py
2,795
3.5625
4
import math import itertools class Node(object): def __init__(self, result=None): self._left = None self._right = None self._operator = None self._result = result def set_expression(self, left_node, right_node, operator): self._left = left_node self._right = rig...
6a3b62187b67dd09afad0f50f57b7b073ec7d186
JackRossProjects/LeetCode-Solutions
/kadanesAlgorithm.py
597
3.921875
4
''' Write a function that takes in an array of integers and then returns the max sum that can be made by summing a subarray of only adjacent numbers of the input array. Example: array = [-10, -2, -9, -4, -8, -6, -7, -1, -3, -5] Output: -1 def kadanesAlgorithm(array): # Base case || 0th index is the largest subarray...
b2b289fedcb5c20bd538eb7f4e7610f48c83aa4e
naiquevin/ML_Playground
/decision-trees/distro-tree.py
5,186
3.59375
4
"""Decision tree algorithm from the book "Machile learning in Action" This algorithm uses the ID3 algorithm """ from __future__ import division import math from collections import Counter from pprint import pprint import numpy as np import pandas as pd import random import pydot from tree import make_node, make_...
83bcc39674f0393fe4b1a924916851c018ac7960
MinWooPark-dotcom/learn-python
/learn_function/variable.param.py
299
4.0625
4
def print_n_times(n, *values): for i in range(n): for value in values: print(value) print_n_times(3, '안녕하세요', '즐거운', '파이썬') # 안녕하세요 # 즐거운 # 파이썬 # 안녕하세요 # 즐거운 # 파이썬 # 안녕하세요 # 즐거운 # 파이썬
f6c91d39762bc171f91a7cd98161361b0aaa6db2
MinWooPark-dotcom/learn-python
/introduction/format03.py
267
3.515625
4
# 의미 없는 소수점 # 제거하기 : 52와 52.0은 자료형이 다르므로 다른 값으로 출력함. 의미없는 0을 제거하기 위해 사용하는 방법 output_a = 52.0 output_b = "{:g}".format(output_a) print(output_a) # 52.0 print(output_b) # 52
5f4a4181b9e08f8f880214e2882b26b06ceec2b7
MinWooPark-dotcom/learn-python
/dictionary/for_dict.py
413
3.671875
4
# for 반복문: 딕셔너리와 함께 사용하기 # for 키 변수 in 딕셔너리: # 코드 pets = [ {'name': '구름', 'age': 5}, {'name': '하늘', 'age': 5} ] for key in pets: print(key['name'], key['age'], '살') numbers = [1, 1, 1, 2, 2, 3] counter = {} for number in numbers: if number in counter: counter[number] += 1 else: ...
effb9dab0ec42f2239824cae9d287799f1c886fe
MinWooPark-dotcom/learn-python
/list/list03-1.py
546
4
4
list_slicing = [0, 1, 2, 3, 4, 5, 6] list_slicing2 = [0, 1, 2, 3, 4, 5, 6] # del 리스트명[인덱스], 인덱스 범위 지정 가능 del list_slicing[3:6] # 3부터 6전까지 삭제 : 3~5 print(list_slicing) # [0, 1, 2, 6] # 왼쪽 모두 제거 del list_slicing[:3] # start 미설정 시 자동으로 0으로 설정(왼쪽 모두 제거) : 0~2 print(list_slicing) # 6 # 오른쪽 모두 제거 del list_slicing2[3:] #...
c7ec4b070309e098d32e07e261c7abb684162de0
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/3_Condities/oefening3.4.py
420
4.125
4
kleinste_getal = float(input("geef het kleinste getal in: ")) grootste_getal = float(input("geef het grootste getal in: ")) print("Het kleinste getal is: ", kleinste_getal) kwadraat_kleinste_getal = kleinste_getal ** 2 print("Het kwadraat van het kleinste getal is: ", kwadraat_kleinste_getal) deling = grootste_geta...
3024fb4a3a5e0308e0267d06e2190eb07ce008d2
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/3_Condities/slides_oefening_p55.py
345
3.96875
4
lengte = float(input("Geef hier je lengte in ( in meter): ")) gewicht = float(input("Geef hier je gewicht in (in kg): ")) bmi = gewicht / (lengte * lengte) if bmi < 18: print("Ondergewicht") elif bmi < 25: print("OK") elif bmi < 30: print("overgewicht") elif bmi < 40: print("obesitas") else: print...
06c0cf69ac55206dd8ddd0007ad91d7a729a9e81
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/3_Condities/oefening3.9.py
874
3.796875
4
getal1 = int(input("Geef het eerste gehele getal in: ")) getal2 = int(input("Geef het tweede gehele getal in: ")) code = int(input("Geef een bewerkingscode in ('1 = optelling', '2 = aftrekking', '3 = vermenigvuldiging', '4 = kwadraat van a', ' 5 = kwadraat van b': ")) if code <= 5: print("Het eerste getal is:", ge...
60e8cd3a5299f6612b95370b13f46b1862b0cc66
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/3_Condities/oefening3.6.py
518
3.515625
4
basis_prijs = 5 jaar_film = int(input("Geef in hoe oud de film is in jaren: ")) rating_film = int(input("geef een rating in van 1-5: ")) if jaar_film < 2: prijs = basis_prijs + 1 else: prijs = basis_prijs if rating_film == 1: prijs = prijs elif rating_film == 2: prijs = prijs + 1 elif rating_film == 3:...
c48553f91d9a8d00e6bf5a0652c5af1d74b2c2ef
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/4_Iteraties/oefening4.7.py
528
3.625
4
temperatuur = 0 aantal = 0 grootste_temp = 0 for i in range(1,10): gemeten_temperatuur = float(input("Geef de gemeten temperatuur om 12u 's middags in: ")) temperatuur = temperatuur + gemeten_temperatuur aantal =+ i if gemeten_temperatuur > grootste_temp: grootste_temp = gemeten_temperatuur ge...
fb9327ecce2d9ee4b11b4cecd9250c09cf9a4a06
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/2_Variabelen/Oefening2.4.py
309
3.796875
4
#Oefening 2.4 U geeft via het toetsenbord het aantal graden Celsius # in. De computer berekent het aantal graden Fahrenheit. # Dit aantal wordt op het scherm afgedrukt. De formule hiertoe # luidt: F=(9/5)C+32 . celsius = float(input("Geef aantal °C: ")) farenheit = 9/5 * celsius + 32 print(farenheit)
7f11fc7e175f001d01bafd49d7310346fea5e26d
JensHuskensPXL/1TIN_IT_Essentials
/IT-Essentials-Oefeningen/4_Iteraties/oefening4.1.py
157
3.515625
4
gewicht_appel = int(input("Geef het gewicht van een appel in: ")) for i in range(1,101): gram = i * gewicht_appel print(i, "appel(s) =", gram, "gr")
d31bbf3b7a5251697a0f360468ad61187e2a892f
felixnoctuae/BI
/DZ3.py
2,495
3.5
4
a = ('Hi', 5, True) b = ('Bye', False, 14) aa = set(a) bb = set(b) c = set.union(aa, bb) c = set.intersection(aa, bb) c = set.difference(aa, bb) c = set.symmetric_difference(aa, bb) print(set.issubset(aa, bb)) print(c) # Создайте пустой словарь, заполните его элементами, # удалите часть элементов, обратитесь к несколь...
302f46caf45eab5e2baa5ec94395e1813e540dbe
DenisEke/BSC_Artificial_Intelligence
/Computational Thinking/Assignment 4/performance_comparison.py
601
4.125
4
# Module to access mathematical functions like log import math # So that we can also calculate for other sizes of arrays AMOUNT_OF_ELEMENTS = 500000 # time complexity of QuickSort using worst case formula bigOQuickSort = AMOUNT_OF_ELEMENTS ** 2 # time complexity of MergeSort using worst case formula bigOMergeSort = ...
125366dd472e886d29b3105274487d485e592b8b
DenisEke/BSC_Artificial_Intelligence
/Computational Thinking/Assignment 4/wordcounter.py
730
4.21875
4
# My code for task 6 of assignment 4 # Describe program and let user enter his sentence print("Hey. You can enter a sentence and I will count how many words there are init: ") # Get his sentence and split it # input returns users input until he presses enter # split splits a string by a certain character; default is ...
3a817b5c5832f36d0010174937da3c4a2a38e163
alexrez/python_basics_-msu-
/6_PublicFriend.py
485
3.59375
4
def update_dict(d, man_1, man_2): if not(man_1 in d): d.update({man_1: {man_2}}) else: d[man_1].add(man_2) if not(man_2 in d): d.update({man_2: {man_1}}) else: d[man_2].add(man_1) guys = eval(input()) friendship = {} while guys[0] or guys[1]: update_dict(friendship, guys[0], guys[1]) guys = eval(input()...
d9c4b88a2eec0b7d183f800f43214fc2edc41b03
alexrez/python_basics_-msu-
/4_LinearLab.py
438
3.6875
4
lab = eval(input()) def go_through_lab(l): global m n=len(l) walk=[n-1] path = set() while(walk): ex = walk.pop() if ex == 0: return True else: path.add(ex) stop = min(ex+1, m+1) for ind in range (1, stop): if l[ex-ind]==ind: if ex-ind+1 not in path: walk.append(ex-ind+1) if ...
2ca8561e2ee148dfbbd4be73d47542c41b608b23
alexrez/python_basics_-msu-
/5_WordsShuffle.py
963
3.625
4
def StrCmp(str1, str2): global kodec words1=sorted(str1.split()) words2=sorted(str2.split()) zpt=[[], []] counter=0 if len(words1)!=len(words2): return False for word in zip(words1, words2): if word[0]!=word[1]: if not word[0].isalpha() or not word[1].isalpha(): if len(word[0])==len(word[1]): for...
781086acd7da3dc7c48af2dfb3301d8c7e38ee6d
DavideLoconte/AIML
/examples/sudoku.py
4,368
3.5
4
import math import sys from constraint.constraint import CSPProblem from utils.stopwatch import Stopwatch def sudoku_pretty_print(table): print("┏━━━┯━━━┯━━━┳━━━┯━━━┯━━━┳━━━┯━━━┯━━━┓") for row_number, row in enumerate(table): print("┃", end="") for col_number, number in enumerate(row): ...
3bbfd520e435be91e72d7771d5af043c6e729c93
paolodelia99/google-code-jam-challenges
/CodeJam2020/Round1A/patternMatching.py
875
3.875
4
def patternMatching(): n = int(input()) p = [input().strip().split('*') for _ in range(n)] prefix, suffix = "", "" # Find the longest prefix and suffix for i in range(n): if len(prefix) < len(p[i][0]): prefix = p[i][0] if len(suffix) < len(p[i][-1]): suffix ...
1c4a3322ac6c5300f3774b3b91bda6386909be9c
paolodelia99/google-code-jam-challenges
/CodeJam2020/Qualification/Indicium/solution.py
781
3.546875
4
for case in range(1, int(input()) + 1): n, k = map(int, input().split()) res = '' if float(k/n).is_integer() and 1 <= k / n <= n: res = 'POSSIBLE' matrix = [[0 for i in range(n)] for j in range(n)] num = k // n for i in range(0, len(matrix)): if i == 0: ...
1a8f14642ccb519b1aa204d73feb648fbb761710
7Cx0/udacity101
/lesson1/43.py
192
3.515625
4
s = 'anystring' print s[3] + ' ' + s[1+1+1] print s[0] + ' ' + (s+s)[0] print s[0]+s[1] + ' ' + s[0+1] print s[1] + ' ' + (s+'ity')[1] #1 character your screwed print s[-1] + ' ' + (s+s)[-1]
615ff11840ad621d7bd04a9deb5da39c17584bfa
7Cx0/udacity101
/lesson2/hw/07.py
107
3.546875
4
def countdown(num): while num > 0: print num num-=1 print "Blastoff" countdown(5)
b18f6dedcc8da22e71954143d2d970494ccfbafb
Manash-git/Competitive-Programming
/toph/Leap Years.py
223
3.59375
4
n= 2004 n= int(input()) if n%4==0 and n%400 !=0: print("Yes") else: print("No") n= int(input()) if n%400==0: print("Yes") else: if n%100 !=0 and n%4==0: print("Yes") else: print("No")
f3d7e111f2bad779decc5be75415e341bae4bdfc
Manash-git/Competitive-Programming
/toph/Better Passwords.py
275
3.84375
4
s = "unsophisticated" s= input() s= s.replace("s", "$") s= s.replace("i", "!") # print(s) s= s.replace("o", "()") s= s.replace(s[0],s[0].upper()) print(s+".") # print(s[0].upper()) # print(s[0].upper()) # print(s[1:].replace("s", "$")) # print(s[1:].replace("o", "()"))
583827a110a02410490366fc628e53d1e7c8870c
SreshthaSaha/Project-98
/swappingFile.py
455
3.578125
4
from os import read def swapFileData(): file_Name1 = input("Enter the name of the first file: ") file_Name2 = input("Enter the name of the second file: ") with open(file_Name1,'r') as a: data_1 = a.read() with open(file_Name2,'r') as b: data_2 = b.read() with open...
dab2156b4c01434186e3ae050e6b9be47413105b
ritikeshshiv/REvision
/New/sum.py
96
4.03125
4
n1=int(input("Enter Number 1:")) n2=int(input("Enter Number 2:")) n3=n1+n2 print("Sum is:",n3 )
8ae91dd17e5e125f03f9ef2e4cd5c3d56816eb4c
ajayajdeveloper/my-python-code-
/containsDuplicate.py
250
3.734375
4
from collections import defaultdict def conatainsDuplicate(nums): m=defaultdict(int) for num in nums: if m[num]: return True m[num]+=1 return False nums=[1,2,3,1] a=conatainsDuplicate(nums) print(a)
d3c67bb8228667b327aa66953e8d387f2be352fc
ajayajdeveloper/my-python-code-
/Queue.py
464
3.796875
4
class Queue: def __init__(self): self.q=[] def enqueue(self,x): self.q.append(x) return x def dequeue(self): if (len(self.q)>0): return self.q.pop(0) def front(self): if(len(self.q)==0): retu...
a2c9adedf8510ca68227f260a44ed4d62a114ab1
adriangonciarz/Python-Exercises
/factory.py
738
3.546875
4
"""\ A generic factory that creates objects for "roles" with registered creation functions. >> f = Factory() >> f.register('A',MyA) # MyA is a class that implements interface A >> ... >> a = f.create('A',1,2,x=3) # create object of role 'A' and pass the other arguments to it's constructor """ #########################...
1062844b2839fac52d411db7cd7bde5966ba176e
adriangonciarz/Python-Exercises
/formatting_proxy.py
1,410
3.546875
4
"""\ Used in alert formatting. Allows administrators to set a format string that formats alerts nicely with all the parameters given by the program. The added value over simple formatting is that if the administrator tries to use a parameter that isn't provided for that alert, it is handled gracefully, and also any p...
f06d4a2714f1a9717d6d0a9b9a847eb5b82e368c
OlgaBaklanova/Animals
/main.py
2,232
3.90625
4
class Animal: def __init__(self, eat, weight, voice, name): self.eat = eat self.weight = weight self.voice = voice self.name = name def eating(self, kg): return self.eat * kg class MakeEgg(Animal): egg = 1 def collect_eggs(self, quantity): return quant...
56e5bc08c9c2e8c4b27fef12d3813dd2e811a650
Hondo2121/Python
/3.4q1.py
111
3.828125
4
c = input("What color? ") l = c.lower() print(l) if (l == "yellow"): print("Correct") else: print("Nope")
62ce64c5d6898f3552c1117e7496d4397db3c689
Hondo2121/Python
/pig_duo.py
1,459
3.5
4
#Hondo2121 #liluda import random import os pt = 0 ct = 0 cts = 0 pts = 0 playerturn = 0 os.system("clear") print(" Welcome to Pig ") print("--------------------") print("Rules: \n Type 'roll', or 'r' to roll.\n Type 'keep', or 'k' to keep your score.\n Your goal is to beat the CPU to 100.") print("") start = str...
5bf237a24241c8b1d86f0cb52035b4b4584a27f7
Qi-Zou/python
/python学习之线程/thread_queue.py
1,532
3.765625
4
# 线程优先级队列 import queue import threading import time exitFlag = 0 queueLock = threading.Lock() workQueue = queue.Queue(10) class myThread(threading.Thread): def __init__(self , threadID , name , q): threading.Thread.__init__(self) self.threadID = threadID self.name = name self.q = q...
6b71f5e61d087077438f4de9de65783e98204850
sampazzer/SI7021
/temp_test.py
559
3.734375
4
#This adds my SI7021 class and returns the temperature and humidity to the console from mySI7021 import temp_humid #Create my sensor object. th_sensor = temp_humid() #Carries out the I2C data transaction. th_sensor.humidity_temp_set() #Gets the humidity value. It is an int rounded to 2 decimal places. my_humidity =...
b9341faa3a0527a0f07beb2a4cd6606595ad884f
martinsauer22/String-Generator
/stringGenerator.py
468
4.34375
4
#!/usr/bin/env python3 import random import string # function that returns random string def generateString(stringSize): stringFinal = "" for i in range(stringSize): stringFinal += random.choice(string.ascii_lowercase) return stringFinal # ask for size stringSize = int(input("Enter size of string: ")) # c...
db7606a7fccbd613232e00a03aa0db37b1915dbd
nbwuwei/itany-python
/core02/student.py
1,322
3.921875
4
class Student: # 类的静态属性 some_static_attr = 1 # 是类的构造方法 # 方法名__init__(self) # self 是this对象 # self 名称可以改变 但是不建议修改 # !!! 一个类中所有成员方法的第一个参数都是self # 但是,在调用类中的方法的时候,不需要为self传值,由Python解释器传值 # Python的成员属性,不需要声明在类中 # 直接在init方法中使用self.属性名 声明成员属性 def __init__(self,name="",age="")...
7bae8d8f852af21a49aea81d67895357329e717e
shreya1901/Python
/area_extension.py
466
3.8125
4
from math import pi r=float(input('Please Enter Radius of circle = ')) a=pi*r**2 print("Area of circle is " + str(a)) file_Name=input("Enter File Name = ").casefold() b=file_Name.split('.') y=b[1] if(y=='py'): print("File extention is python") elif(y=='java'): print("File extention is java") elif(y=='cpp'): ...
5c50c4d5ec27ec34a8e21ec123dbdc179877b37d
brianz6715/LeetCodePractice
/LC198_HouseRobber/houseRobber.py
384
3.609375
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ @author: BrianzChang """ class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ length = len(nums) if length == 1: return nums elif length == 2: return...
c5ef39ff242d67f2d1b1c8af6fa63feba78dabc2
brianz6715/LeetCodePractice
/LC021_MergeTwoSortedLists/mergeSortedLists.py
1,539
4
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat Apr 1 17:03:54 2017 @author: BrianzChang """ class ListNode(object): def __init__(self, x): self.val = x self.next = None class LinkedList(object): def __init__(self): self.first = None self.last = None ...
d18ab9b32a14a0e83f321f7fcd2b5a4d4e777669
NikosNtafopoulos/Python-Documentation
/Classes/classExample1.py
2,232
4.0625
4
# A class is basicaly a blueprint for creating instances # Instances are class-based generated elements # Instance contains data that is unique for every instance # each regular method on a class takes automaticaly the instance as a first argument --> self # classmethods recieving the class[cls] as the first argument a...
cf67c2b68594dc53d4411bd50e4aa2528ca3033d
NikosNtafopoulos/Python-Documentation
/Data Structures/ListComprehensions.py
1,056
3.875
4
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # i want 'n' for each 'n' in nums myList = [] for n in nums: myList.append(n) print myList # or myNewList = [n for n in nums] print myNewList for n in nums: print n.numerator # n*n for each 'n' in nums myList2 = [] for n in nums: myList2.append(n*n) print myList2 #...
ed269391b177709b4cb9677de18307b90df0fc47
gauravg26/python_codeChallenges
/gaurav_gupta_OpenEdx submission 11.py
1,055
4.0625
4
# addition function def add(*args): print args addition = 0 for item in args: addition += item return addition # Multiplication function def mul(*args): multiply = 1 for item in args: multiply = multiply* item return multiply # Largest number Function def lar(*args): larg...
e1bcc32f13c0320cf349375c88e9ef823170ed32
slowisfaster/algorithm024
/Week_04/climbing_stairs.py
485
3.578125
4
class Solution: def climbStairs(self, n: int) -> int: #if n<=2: return n #return self.climbStairs(n-1) + self.climbStairs(n-2) s = {} s[0] = 1 s[1] = 2 for i in range(2, n): s[i] = s[i-1] + s[i-2] return s[n-1] """ if n<=2: return n...
cda133d0452cbbac08f8565c1c24d684f0931167
slowisfaster/algorithm024
/Week_01/rotate-array.py
2,128
3.5625
4
class Solution:     def rotate(self, nums: List[int], k: int) -> None:         """         Do not return anything, modify nums in-place instead.         """         #O(n),         #[nums.insert(0,nums.pop()) for _ in range(k)]                  #O(n), O(n)         """         n = len(nums)         new = [0 for _ in rang...
ab48d2ab3abd6f5758457bc410f6900c0d49a322
plutoese/dataplayer
/dataplayer/dojo/dojo_one_object.py
2,889
3.609375
4
# coding=UTF-8 import random class X: pass print(X.__class__) print(X.__class__.__base__) class Card: def __init__(self,rank,suit): self.suit = suit self.rank = rank self.hard, self.soft = self._points() class NumberCard(Card): def _points(self): return int(self.rank), ...
2e5ddb1c293fc205f41f50b2fa8473b5fa73ec88
SamNel2000/Cyclic-Sums
/TrueCSS search.py
1,899
3.8125
4
#Cyclic Sum Sets, Actually looking for real CSS now not "Combinatorial Sum Sets" #Sam Nelson, 2/20/2020. Thanks Bruce and Dr. Haile. import timeit start = timeit.default_timer() size = int(input("What order of a tuple do you want to test? ")) + 1 #Order is one less than the number of terms, thus a one is added so t...
2b58be4da8bdb20721f7a85b09b6bf5030be90fc
PedroGustavo1/Exercicio_Fila
/Questão_2.py
528
3.703125
4
class Fila: def __init__ (self): self.fila = [] def enqueue (self,valor): self.fila.append(valor) def dequeue (self): if not (self.isEmpty()): self.fila.pop(0) def isEmpty (self): return len(self.fila)== 0 def Length (self): ...
8350f3c8edc92016f258390e9e0cf1231703b027
Abhinaay/Python-Challenges-Adhoc
/Problem3.py
603
4.21875
4
#Problem : take a list say adhoc=[1,2,3,1,4,5,66,22,2,6,0,9] # write the program that will do # i) print only those numbers greater than 5 # ii) also print those numbers those are less than or equals to 2 ( <= 2 ) # iii) store these answers in in two different list also ...
87ff93188631e04d0de0f869b1826fd253feb74f
Abhinaay/Python-Challenges-Adhoc
/Problem9.py
2,013
4.03125
4
#Problem : write a code that will take user input until number of character not exceeding # 500 chars. #Now do the following tasks: #i) print the number of repeated characters in descending order #ii) print number of repeated words in descending order #iii) if a word is repeating more than 5 times remove all t...
7efc355d7fca7e3946a4b353f23523256a1375f5
lg-showtime/request01
/高性能异步爬虫/awite详细了解.py
504
3.671875
4
# 协程是啥? # 协程是在单线程中遇到io请求去切换代码块执行的一种技术 import asyncio async def func1(): print("事件1") await asyncio.sleep(2) print("事件1完成") async def func2(): print("事件2") await asyncio.sleep(2) print("事件2完成") task = [ asyncio.ensure_future(func1()), asyncio.ensure_future(func2()) ] loop = asyn...
d134d87f1b83fe1100f4384e7822675ad19e3e50
nouran0/TermProject_RainbowTable
/rainbow_table.py
3,897
3.796875
4
import hashlib import base64 def md5_hash(p, t): ''' This method return hashed password/passwords using MD5 hash :param p: password :param t: list of passwords or one password :return: hashed password/passwords ''' h_pass = {} if t.lower() == 'list': for i in p: h_pa...
cf09befb54554315b2d444c045de819e33d32aed
wotsushi/competitive-programming
/gcj/2019/qualification/b.py
280
3.53125
4
T = int(input()) for x in range(1, T + 1): # 入力 N = int(input()) P = input() # PのEとSを反転させた文字列が解 y = ''.join( 'E' if p == 'S' else 'S' for p in P ) # 出力 print('Case #{}: {}'.format(x, y))
c2e1cc64f4ed722903b874b14a601a4d680c0b51
devedzic/lennon
/python/tuples.py
1,748
4.78125
5
"""Demonstrates tuples """ def demonstrate_tuples(): """Creating and using tuples. - create and print 1-tuple, 2-tuple, mixed-type n-tuple - accessing elements of a tuple using [] - demonstrate that tuples are immutable """ empty_tuple = () print(empty_tuple) one_tuple = ('John Lennon...
8d8fa94e035334ef75a498f0304112187d3308c9
devedzic/lennon
/blankscripts/bandblank.py
4,855
4.15625
4
"""The class representing the concept of a music group/band. It includes a list of Musician objects (band members) and the date when the band started performing together. """ from datetime import date, datetime, time import json # from music.musician import Musician # from util.utility import format_date class Band...
224e52cf77a1b9431676bf5938d1b344a913f565
Nagato35/acmp-solutions
/solutions/25.py
148
3.796875
4
print('Vvedite dva chisla') a = int(input()) b = int(input()) if a > b : print('Znak : >') elif a < b : print('Znak : <') else: print('Znak : =')
39729ce6801d913e7d9c881b297490e72953cda5
Nagato35/acmp-solutions
/solutions/942.py
700
3.59375
4
print('Введите количество задач, а затем минут') a = [] b = [] for i in range(int(input())): a.append(int(input())) sum = 0 wtraf = 0 for number in a: sum = sum + number + wtraf wtraf = wtraf + number b.append(sum) a.reverse() sum2 = 0 wtraf2 = 0 for number in a: sum2 = sum2 + number + wtraf2 wtraf2 = wtraf2 + n...
0f866fb8901f10ebc7a2f2529dadb19140f03edf
Nagato35/acmp-solutions
/solutions/81.py
165
3.53125
4
print('Введите массы арбузов') a = [] for i in range(int(input())): a.append(int(input())) print('Теще -',min(a),', себе - ', max(a))
2524d089379c73dd3a64a53b24224aae7cfc4fb8
Nagato35/acmp-solutions
/solutions/894.py
312
3.75
4
print('Введите площадь кольца , а затем радиус большего круга') import math s = float(input()) a = float(input()) b = ((3.14159265359 * a ** 2 - s) / 3.14159265359) ** 0.5 b = int(b * 1000) b = b / 1000 print('Радиус меньшего круга равен:',b)
d4e2812a9787f81f42cf181aab89fa9177cbedad
Nagato35/acmp-solutions
/solutions/312.py
213
3.828125
4
print('Введите первые 2 элемента прогрессии') a = int(input()) b = int(input()) c = int(input()) print('Следующий элемент прогресии - ',b + (b - a)*(c - 2))
a0f62eab75de27cc3a151cc831005a11798b6a16
Nagato35/acmp-solutions
/solutions/8.py
167
3.78125
4
print('Введите 3 натуральных числа') a = [] for i in range(3): a.append(int(input())) if a[0] * a[1] == a[2] : print('YES') else: print('NO')
12295132979cbeaabf6ec1705fa336b95299a5ab
Nagato35/acmp-solutions
/solutions/970.py
181
3.875
4
print('Введите три целых числа ') a = int(input()) b = int(input()) c = int(input()) if a + b == c or a + c == b or b + c == a : print('YES') else: print('NO')
bb5bf222f71854cf059cb7bd9b8d31e96de29781
stkobsar/basketball_webscrapping
/scrapping_basket/preprocessing_dataset.py
369
3.578125
4
### Future implementations def preprocessing_dataset(csv): df_nba = pd.read_csv(csv) # 1 Query for player --> Player --> (1/2/3% numericos 1 jugador) !! # 2 Query for team --> Team --> for player in team: Query Player (numericos todos los jugadores, wins) # 3 Visualization --> for team in teams --> Query Team -...
0ce1de3b2c5b9a9f5c14a2af6bb01e66d7b54082
gitPty/windows7
/windows7/mpl_squares.py
490
3.703125
4
# -*- coding: utf-8 -*- """ Created on Wed Mar 20 16:29:33 2019 @author: Administrator """ import matplotlib.pyplot as plt input_values=[1,2,3,4,5] squares =[1,4,9,16,25] plt.plot(input_values,squares,linewidth =5) #设置图表标题,并给坐标加上标签 plt.title("Square Numbers",fontsize=24) plt.xlabel("Value",fontsize...
c6469d2a545f3249abcc3539f22bd2d7ae1d1af6
gitPty/windows7
/windows7/unit16/highs_lows.py
1,283
3.5
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 21 19:14:04 2019 @author: Administrator """ import csv from datetime import datetime from matplotlib import pyplot as plt #从文件中获取最高气温 filename ='death_valley_2014.csv' with open (filename) as f: reader =csv.reader(f) header_row =next(reader) ...
a15331cd0f44c1f9828d2b768b4d97b3b88bdf03
soumyasen1809/NPTEL_IITG_Numerical_Methods_and_Simulation
/Heun_Method.py
1,115
3.734375
4
# Heun method to solve differential equation dy/dx = 2y/x for y(2) using step size 0.125 and initial condition y(1) = 2 from matplotlib import pyplot as plt def func_xy(x,y): # Defining the function f(x,y) = dy/dx = 2y/x (slope at the point) val = 2*y/float(x) return val def Euler(x,y): ...
c360c7aef5b40ada20e511d682b0a3d3ffa517e7
soumyasen1809/NPTEL_IITG_Numerical_Methods_and_Simulation
/Roots_of_Non_Linear_Equations.py
840
3.828125
4
# Nonlinear Equation to solve is: f(x) = a - 1/x = 0 for a>0 (Non linear equation) import numpy as np from matplotlib import pyplot as plt a = 0.2 # Defining a = 0.2 count = 0 # Count number of iterations x_0 = 0.01 # Initial guess value eps = 100 # Error epsilon err = [] while eps > 0.005: ...
009d94a6f76f6f6eedccb43064e7edece1810bed
odvk/ynd-da-crs
/code/ya-ds-07-05-04.py
1,045
3.515625
4
#Описательная статистика #Задача4 / 7 #Найдите минимальное ненулевое время прослушивания композиции в жанре pop. Сохраните его в переменной pop_music_min_total_play, значение выведите на экран. Вывод результата предыдущей задачи закомментируйте. import pandas as pd df = pd.read_csv('music_log_upd.csv') # код ниже pop...
cf945fb437d3d0fff056083e6b44f920b23ce43c
odvk/ynd-da-crs
/code/ya-ds-03-09-01.py
851
3.53125
4
# 9. Новые столбцы (добавление элементов в список) #Новые столбцы (добавление элементов в список) #Задача1 / 2 #Добавьте в список названий emoji ещё три следующих элемента, используя метод append(). Выведите результат на экран. emoji = [ 'Ухмыляюсь', 'Сияю от радости', 'Катаюсь от смеха', 'Слёзы радости', 'П...
7641daf51231578793a098469d03c297144226f0
odvk/ynd-da-crs
/code/ya-ds-06-06-08.py
785
3.78125
4
# #8 / 8 # : '' 'genre_name'. , 0. genre_final_count ( . final count, ), . import pandas as pd df = pd.read_csv('music_log_upd_nan.csv') df['genre_name'] = df['genre_name'].replace('', 'electronic') genre_final_count = df[df['genre_name'] == '']['genre_name'].count() print(genre_final_count)
931693d8e829eeb2f27cf51233b91420c6a2fdb7
killian-mahe/the_eternal_kingdom
/player.py
435
3.78125
4
# -*- coding: utf-8 -*- class Player: """A Player """ def __init__(self): """Create an instance of Player """ self.score = 0 self.name = "" pass def add_score(self, score): """Add score to the player Arguments: score {int}...
b9947702b74c46a84194737e12f3ad1c3d65181d
killian-mahe/the_eternal_kingdom
/characters/zombie.py
912
3.671875
4
# -*- coding: utf-8 -*- # Standard imports import time # Package imports from IO import Terminal # Internal imports from characters import Monster class Zombie(Monster): def __init__(self, monster_model_file, position, life=1, speed=3): """Create an instance of Zombie Arguments: ...
4cd596a068fa01db779c56ffb9bd9f50cee6f46b
naveenbkori/Neural-Network-in-Python
/NeuralNet.py
11,244
3.71875
4
import numpy as np def sigmoid(x): return (1.0/(1+ np.exp(-x))) def sigmoid_derivative(x): return (x * (1.0 - x)) class Neuron: eta = 0.3 alpha = 0.5 def __init__(self, neuronNum, numOutputs): global neuronCount self.neuronNum = neuronNum self.numOutputs = numOutputs ...
7be605d10f3dafc43e6936640b674f4310df4cd1
andrew030987/Homework
/1.py
298
4.125
4
# Есть список a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]. # Выведите все элементы, которые больше 8, но не более чем в 5 раз. a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] result = [num for num in a if num > 8 and num <= 40] print(result)
aeabb533ba651328f8345fcac2bb9aa2c35e90f5
lhow0901/dsp
/python/q8_parsing.py
1,042
4.375
4
# The football.csv file contains the results from the English Premier League. # The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of # goals scored for and against each team in that season (so Arsenal scored 79 goals # against opponents, and had 36 goals scored against them). Write a program to r...
6ecf4a436729a9b828fe00ea4e5dca8236f5822d
lhow0901/dsp
/python/advanced_python_regex.py
1,430
3.953125
4
import sys import os import csv def count_degrees(csv_file_name): with open(csv_file_name) as f: faculty = csv.reader(f, skipinitialspace=True) next(faculty) degrees = list() for row in faculty: degree = row[1] degree = degree.replace(".","") degr...
d89748c1544acc1edeff74580967cf42d2333b1c
Autonomousgroup8/Lab-1
/Lab4/python/locatemarkerclient/pathfinding.py
6,310
3.5625
4
# import timeit # code_to_test = """ from operator import add import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from numpy.linalg import norm def PathFinding(grid): # Setup array with distance data height = grid.shape[0] width = grid.shape[1] pathdata = np.zeros((height, wid...
fe6939a502be157f92cd87273633426ce282b042
adadesions/python_class
/data_structure/dictionary.py
462
4.21875
4
""" dict = { key1: value1, key2: value2, } """ # Create fruit = { 'apple': 10, 'pine-apple': 12, 'orange': 14, } # Access print(fruit['apple']) # Update and Edit fruit['grape'] = 5 print(fruit) fruit['apple'] = 9.5 print(fruit) # Delete del fruit['grape'] print(fruit) # loop for key, val i...
d0cfa3fa4d3d966db5ab0d10b1dc1710ffbc5203
shulyak86/hillel_ira
/homework 7 lesson/task2.py
635
3.734375
4
a = input('vvedite temperaturu: ') b = input('vvedite shkalu (C, K, F): ') def isx_c(): print(a, 'C', '\n', int(a)+273, 'K', '\n', int(a)*1.8, 'F') def isx_k(): print(a, 'K', '\n', int(a) - 273, 'C', '\n', int((int(a)-273) * 1.8), 'F') def isx_F(): prin...
1550a2a09f65eaea5cd9661c6efe33d81ad2876a
shulyak86/hillel_ira
/homework 3 lesson/task5.py
213
3.984375
4
i = 0 print('random_number is') while i < 3: i = i + 1 a = input('Please enter an number:') if int(a) == random.randint(0, 10): print('You won!') else: print('You lose!')
e5bf2daed192a2ab8ddfb98b0f4f372b2726f6aa
shulyak86/hillel_ira
/homework 4 lesson/task2.py
905
3.703125
4
print('Please enter integer positive numbers') n = 0 count = 0 summa = 0 composition = 1 average = 0 max_n = 0 index_max_n = 0 count_chet = 0 count_nechet = 0 max_2 = 0 count_max = 1 while True: n = int(input()) if n == 0: break count += 1 summa += n composition *= n ...
946b2936546bdb2eed45ffc83102e7ecc3b1ecda
venkat1077/python_concepts
/head_tail_recursion.py
310
4.0625
4
# recursion at head and tail level def head_recursion(n): if n == 0: return else: head_recursion(n-1) print n head_recursion(10) def tail_recursion(n): if n == 0: return else: print n tail_recursion(n-1) tail_recursion(10)
29da6376a286d8f16a0b71f0e96021fd1693e564
happyhappyhappyhappy/pythoncode
/atcoder/beginners/chap2/pastfiles/ABC095A_1.py
499
3.53125
4
# Problem https://atcoder.jp/contests/abc095/tasks/abc095_a # Python 1st Try def addCost(infoTicket): result = 0 if infoTicket[0] == 'o': result = result + 100 if infoTicket[1] == 'o': result = result + 100 if infoTicket[2] == 'o': result = result + 100 return result def ...
b0ff8859caedd4555236418f70a7fdf52a95189e
happyhappyhappyhappy/pythoncode
/atcoder/mizuiro_h20/unionfind/ABC177D_friend/used2dsu/copy.py
2,089
3.53125
4
class UnionFindDsu(): n=1 parent_or_size=[-1 for _ in range(0,n)] def __init__(self,N): self.n=N self.parent_or_size=[-1 for _ in range(0,N)] def merge(self,a,b): assert 0<=a<self.n,"0<=a<n,a={0},n={1}".format(a,self.n) assert 0<=b<self.n,"0<=b<n,b={0},n={1}".form...
669f16b5ad05a908680411718286298b32e9b59c
happyhappyhappyhappy/pythoncode
/atcoder/beginners/chap1/ABC086A_3.py
226
3.765625
4
# Problem # Python 3rdTry yes = "Odd" no = "Even" if __name__ == "__main__": answer = "" a, b = map(int, input().split(' ')) if (a*b) % 2 == 1: print(yes) else: print(no) print(answer)
6ab838a6d1a3f8460697bd048a09fe395f1729fc
happyhappyhappyhappy/pythoncode
/atcoder/beginners/chap2/pastfiles/ABC069B_2.py
516
3.671875
4
# Problem https://atcoder.jp/contests/abc069/tasks/abc069_b # Python 2nd Try def solver(inputStr): result = inputStr[0] + str(len(inputStr)-2) + inputStr[-1] return result if __name__ == "__main__": result = solver(input()) print(result) # Problem https://atcoder.jp/contests/abc069/tasks/abc069_b # ...
5e82c179af5e7eafe6ddffea2f5401b5a0870bec
happyhappyhappyhappy/pythoncode
/verifyENV/Snippets/oneliner.py
828
3.953125
4
# 1行プログラムのコレクション # 参考 https://towardsdatascience.com/become-a-python-one-liners-specialist-8c8599d6f9c5 # 以下インポート文 # (1)2変数の交換 print("#1 Swapping the value of 2 variables") a = 10 b = 5 print("a = {}/ b = {}".format(a, b)) b, a = a, b # Key print("a = {}/ b = {}".format(a, b)) # (2)List 作成/フィルタ print("#2 List com...
1e1a1c0055cf6f633649b87f6f885cbe9298647e
happyhappyhappyhappy/pythoncode
/atcoder/mizuiro/joi2008yo_e_osenbei/samples/samplezip.py
949
3.78125
4
ZIPS = list(zip([1,2,3,4,5],["a","b","c","d"])) print("ZIPS type = {}".format(type(ZIPS))) # <class 'list'> print("ZIPS IN = {}".format(ZIPS)) # ZIPS IN = [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')] cnt = 1 for z in ZIPS: print("{} : {}".format(cnt,z)) # 1 : (1, 'a') # 2 : (2, 'b') # 3 : (3, 'c') # 4 :...
e8efa358dbcf8b5170499181d77262ce59172190
happyhappyhappyhappy/pythoncode
/verifyENV/202002/youtube2ios/main/byte2si.py
828
3.625
4
import math def main(byte): # byteの桁数を取得して、3桁刻みに単位を変えてくだけ if 0 <= byte: dig = int(math.log10(byte)) if 0 <= dig < 3: bytes = byte / pow(10, 0) return bytes, 'B' elif 3 <= dig < 6: bytes = byte / pow(10, 3) return bytes, 'KB' elif ...
9868babbb00ee5d40d896c7bf8eafc1e45d6cbd2
Starwort/wanakana-py
/wanakana/common.py
5,216
3.59375
4
from typing import Iterable, Union, List from collections import deque import re from .utils import ( is_empty, is_char_hiragana, is_char_katakana, is_char_japanese, is_char_kana, is_char_kanji, is_char_romaji, is_char_english_punctuation, is_char_japanese_punctuation, ) def is_hir...
7091617c443e6cb166611568d47724fac020ed27
Spartak-Belov-Floresku/restful-apis-lucky-nums
/helper.py
1,828
3.765625
4
import random import requests """class will checking, processing and sending user data""" class UserData: def __init__(self): self.name = '' self.year = 0 self.email = '' self.color = '' """method that checks user data for validation and setups flag of result""" def chec...
d642b6017ae8efb6293c6b2d65e66565edc7fcd6
kszabo/MITCS50
/pset6/vigenere.py
1,837
3.9375
4
import cs50 import sys def main(): if len(sys.argv) != 2: print("Usage: python ./vigenere.py k") exit(1) # check input and build the key array at the same time asciikey = [] for c in sys.argv[1]: if c.isalpha() == False: print("Usage: python ./vigenere.py k") ...
ace3f997fb96bc9d5f8949c4393e94dcc6b75734
isfish/excises
/python_excises/000.py
1,296
4.09375
4
''' 题目:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 思路:这题目的主要目的是考察利用Python对图像进行处理,具体的过程为: - 获取图片 - 定位图片位置 - 添加数字(个人认为此处应该是随机数字) - 保存图片(保持原有的图片格式) 作者: isfish 日期: 2018-09-20 版本: v01 ''' # 导入相关的包 import PIL import argparse import numpy as np # 仅需要pillow和argparse不知是否已经足够? def addMessNum(pic, loc,num): picLoad = I...
f6fd0a0f2987f4a72b589a87020b5cb2f57a9d49
therealprocyon/python-port-tool
/network.py
1,289
3.5
4
#!/usr/bin/env python3 import platform import ipaddress import socket import tls_check import client import validators import re import client_tls def main(): global port global host response = input("Enter an IP or hostname address: ") print(response) try: if re.match("^\w+...
793848242611028c13be29ec6d619a633cf9aa9c
priyankaparikh/algorithms
/LRU_cache/lru_cache.py
2,399
4.03125
4
""" A doubly linked list imagined and utilized as an LRU cache that gives us 0(1) get, pop and delete operations""" class dlNode(): """A single node object for the double ended linked list implementation""" def __init__(self, key=0, value=0, prev=None, next=None): self.key = key self.value = va...
4e07fb2112204faaa71975e7f753a44a7f5bc951
priyankaparikh/algorithms
/arrays/merge_sorted.py
1,316
3.578125
4
def find_duplicate_files(paths): duplicates = [] mapping = {} for path in paths: info = path.split() path = info.pop(0) for detail in info: file_detail = detail.split('(') file_name = path + '/' + file_detail[0] file_text = file_detail[1] ...
58d91cc1c0374db2eecf5608d1a0baf0cf7b66b8
zwm/pytest
/SpecialMethods.py
700
3.546875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # test special methods ''' * Special methods work on type only!!! ''' class C(object): def __len__(self): return 0 cobj = C() def mylen(): return 1 cobj.__len__ = mylen print len(cobj) ''' * A simple technique to allow defining suc...