blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
a4dc3cd347d51489c76bb0c424b750489bf36a4a
Lieberator/Old_Projects
/Part1/Beginning Pract./dictionaries.py
1,814
3.625
4
"""alien_0 = {'color': 'green', 'points': 5} alien_points = alien_0['points'] alien_0['x-pos'] = 0 alien_0['y-pos'] = 25 print("The alien's x position is: " + str(alien_0['x-pos'])) alien_0['x-pos'] = 15 print("The alien's x position is now: " + str(alien_0['x-pos'])) del alien_0['color'] print(alien_0) """ """ us...
bec7a986463068b186ec0ecda4e0bb463ee2707d
Lieberator/Old_Projects
/Part1/Beginning Pract./whileloops_UserPass.py
1,524
4.03125
4
""" message = input("Tell me something, and I'll repeat it back to you: ") print(message) age = input("Please enter your age: ") age = int(age) while(age <18): print("You are only: " + str(age) +", you must wait until your 18") age+=1 print("Finally you are " + str(age) + "! You may enter.") request = '' todo_...
28ebc14eb089e706c1fa2e93404bb1cbe1859cf3
Henrikmdk/pcc_5
/main.py
3,611
3.96875
4
import random # 5-1 Conditional tests - new file ? car = '' cars = ["Subaru", "Audi", "VW", "Opel", "Koenigsegg"] # picking a car from the list and assigning it to a String car = cars[0] # testing the build of the car print("Is car == 'subaru'? I predict this to be True") print(car.lower() == 'subaru') print("\nIs ...
d8c828b97b0724bd5d2eb2e58baff14f0810ee17
calofmijuck/SNUCSE
/2018 Spring/Engineering Mathematics 2/pi.py
351
3.609375
4
import random ## Total number of iterations iter = 100000000 ## How many iterations satisfy the constraint count = 0 for i in range(0, iter): ## Generate two random values from [0, 1) x = random.random() y = random.random() if x **2 + y ** 2 <= 1: count += 1 print("pi is approximately {0:.1...
77c0919ef0248476172e942be664358abb7d315c
pedrocarvalhoaguiar/Prova_P1_Vassouras
/Pedro-Carvalho-Aguiar_Questao04.py
437
3.9375
4
tamanhoLista = int(input('Digite o tamanho da lista: ')) listaNumeros = [] def SomaLista(tamanho, lista): soma = 0 while len(lista) < tamanhoLista: valor = int(input('Digite um valor para lista: ')) lista.append(valor) for i in lista: soma += i return soma somaDeTodos = SomaLis...
8b93a72a07be2865330628e84d8255718bf838d0
aakash19222/Pis1
/p.py
351
4.1875
4
def rotate(s, direction, k): """ This function takes a string, rotation direction and count as parameters and returns a string rotated in the defined direction count times. """ k = k%len(s) if direction == 'right': r = s[-k:] + s[:len(s)-k] elif direction == 'left': r = s[k:] + s[:k] else: r = "" print...
c8c3de51f3c5828ac8ce280924f83c7d8474b3c0
PrinceCuet77/Python
/Extra topic/lambda_expression.py
824
4.3125
4
# Example : 01 def add(a, b) : return a + b add2 = lambda a, b : a + b # 'function_name' = lambda 'parameters' : 'return_type' print(add(4, 5)) print(add2(4, 5)) # Example : 02 def multiply(a, b) : return a * b multiply2 = lambda a, b : a * b print(multiply(4, 5)) print(multiply2(4,...
3c9643a834ac4a198aac61ecad176b6aab31dfa6
PrinceCuet77/Python
/Extra topic/filter_function.py
343
4.09375
4
# Example : 01 # Finding even number from another list using filter function l = [i for i in range(1, 11)] def is_even(a) : return a % 2 == 0 evenList = list(filter(is_even, l)) print(evenList) print() # Finding even number from another list using lambda expression evenList2 = list(filter(lambda a : a % 2 == ...
bd802c4bae44b75a820c70349a5eab4221bac821
PrinceCuet77/Python
/Tuple/tuple.py
1,323
4.3125
4
example = ('one', 'two', 'three', 'one') # Support below functions print(example.count('one')) print(example.index('one')) print(len(example)) print(example[:2]) # Function returning tuple def func(int1, int2) : add = int1 + int2 mul = int1 * int2 return add, mul print(func(2, 3)) ...
553c0af65afd7d80a9ebfca8a1bc80f1ab660726
PrinceCuet77/Python
/List/list_comprehension.py
1,520
4.28125
4
# List comprehension # With the help of list comprehension, we can create a list in one line # Make a list of square from 1 to 10 sq = [i**2 for i in range(1, 11)] print(sq) # Create a list of negative number from 1 to 10 neg = [-i for i in range(1, 11)] print(neg) # Make a list where store the first character fro...
3c28a8354f25054d6cb29450f79d7fe5e54017fc
PrinceCuet77/Python
/Basic things of python/escape_sequences.py
819
3.90625
4
print("Hello \"Earth\"") # Double qoutation escape print('I\'m Prince') # Single qoutation escape print("This is backslash\\") # Backslash escape print("This is double backslash\\\\") print("This is 4 backslash\\\\\\\\") # 4...
ced0b03d144b7ac9d229734c4a858b6f2a0ccc8a
mernst32/Py-SCSO-Compare
/download_stackoverflow_codesnippets/so_helper.py
2,358
3.59375
4
class StackOverflowItem: """ Object representing a Stackoverlow entity """ def __init__(self, so_id, i_type, src, dest): """ :param so_id: id of the SO entity :param i_type: the type of the SO entity: answer, question :param src: from where the link for this entity comes...
31fa2d5e092772a410763d8dbc547fa75fb81246
yuuumiEL/Algorithm-Beakjoon
/Beakjoon/8393_합.py
80
3.546875
4
n = int(input()); sum_ = 0 for i in range(1, n + 1): sum_ += i print(sum_)
413a5ca5d74f7e0906e2b36407df4f73759a224b
graybri/py-tutor
/strings.py
934
4.0625
4
# New comment # Another comment # import os print('Hello World') message = 'Hello World' print(message) # Embedded Quote print(message) print("Bobby's World") print('Bobby\'s World') # multiline triple quotes ''' message2 = '''Hello World was a good place to hang out''' print(message2) # char...
b081e3423672a0f182c1e959348c39943cab23b8
lokshi/Python-Study
/NumGuess.py
553
3.859375
4
import random secret = random.randint(1,10) guess = 0 tries = 0 print "AHOY! I'm the Dread Pirate Roberts, and I have secret!" print "It is a number from 1 to 9. I'll give you 3 tries." while guess != secret and tries < 3: guess = input("What 's your guess?") if guess < secret: print " Too low!" e...
712f46fc65f3c6d3c8ca8154748f9a942c6781f2
cnaseeb/Pythonify
/queue.py
815
4.125
4
#!/usr/bin/python class Queue: def __init__(self): self.items = [] def isEmpty(self): return self.items ==[] #further conditions implementation needed def enqueue(self, item): return self.items.insert(0, item) #further checks needed if queue already contains i...
d5988c5aa963304749ce88d776aab2883a284460
cnaseeb/Pythonify
/binarySearch.py
638
4.03125
4
#!/usr/bin/python #Binary search def binarySearch(list, value): first = 0 last = len(list)-1 result = False while first <= last and not result: midpoint = (first + last)//2 if(midpoint == value): result = True else: if value < list[midpo...
5e7baf6c5a5072642ad14a4aceb0d107dc8f4ee1
wystephen/theano_test
/csvread.py
677
3.65625
4
#-*- coding:utf-8 -*- ''' 程序说明(Introduce): 引用(References): 创建时间:’2015/8/15 15:46' 编写与修改: ''' __author__ = 'WangYan' import numpy as np import csv import os def read_csv(): train_set =np.genfromtxt('train.csv',delimiter=',') test_set = np.genfromtxt('test.csv',delimiter=',') train_y = train_set[:,0] ...
712e30c886ade9fa8b998251e383c0966c6cebb1
Algebra-FUN/My-Data-Structure
/Exp/4/4.py
947
4.03125
4
def char_summary(word_list): summary = [" "] for word in word_list: for char in word: if char not in summary: summary.append(char) summary.sort() return summary def dict_sort(word_list): char_sum = char_summary(word_list) max_len = max(map(len,word_list)) ...
07236cbcef280b2d16606eddb2fe7984945852ab
sharonsabu/pythondjango2021
/oops/oops8.py
371
3.890625
4
class Person: def __init__(self,age,name): self.age=age self.name=name p=Person(27,"ram") p1=Person(26,"varun") p2=Person(24,"nikhil") employees=[] employees.append(p) employees.append(p1) employees.append(p2) for emp in employees: if emp.age>25: print(emp.name) age=[] for emps in e...
9550daacf250658a045a398aa36da72105c6edab
sharonsabu/pythondjango2021
/file/employees/emp1.py
527
3.8125
4
employees={1000:{"eid":1000,"ename":"ram","desig":"developer","salary":30000}, 1001:{"eid":1001,"ename":"raj","desig":"tester","salary":25000}, 1002:{"eid":1002,"ename":"rahul","desig":"programmer","salary":30000}} eid=int(input("enter employee id")) property=input("enter property value") if eid ...
debe9e700a4980bcdc5abae022dab754c9edb48c
sharonsabu/pythondjango2021
/functions/mathmod.py
190
3.65625
4
def add(num1,num2): return num1+num2 def sub(num1,num2): return num1-num2 def mul(num1,num2): return num1*num2 # usage of this functions refer calc directory and testwork file
65ca69ad965cd2fa808afcde8f29b8e72a2a8378
sharonsabu/pythondjango2021
/questions/pattern3.py
210
3.90625
4
#question in book for row in range(1,6): for col in range(1,10): if(row==5)|(col+row==6)|(col-row==4): print("*",end=" ") else: print(" ",end=" ") print(" ")
84b72330d543f996bad92203e697548a78c8cba2
sharonsabu/pythondjango2021
/flowcontrols/decisionmaking/largestamongtwo.py
150
4.15625
4
num1=int(input("enter 1st number")) num2=int(input("enter 2nd number")) if(num1>num2): print("num1 is largest") else: print("num2 is largest")
0c4b232748db77491e41c77f064524c4a66d34d9
sharonsabu/pythondjango2021
/oops/oops7.py
255
3.78125
4
#inheritance #multiple class parent: def m1(self): print("inside m1") class subchild: def m2(self): print("inside m2") class child(parent,subchild): def m3(self): print("inside m3") ch=child() ch.m2() ch.m1() ch.m3()
0504746e9acee9a410b5ced0818b537119b9c40a
sharonsabu/pythondjango2021
/oops/oops4.py
320
3.9375
4
#usage of constructor class employee: company_name="ctc" def __init__(self,age,name): self.age=age self.name=name def print_person(self): print(self.age) print(self.name) print(employee.company_name) emp=employee(24,"amal") print(emp.name) print(emp.company_name)
dd7a54e473d494438f31a8d0115c25bc29c050bc
sharonsabu/pythondjango2021
/python_collections/list/listpgm1.py
367
3.78125
4
lst=[] print(type(lst)) #or num=int("10") lst=list() print(type(lst)) #next lst=[10,11,11,12,'hello',10.5] print(lst) #next (update pgm) lst=[10,20,30,40] print(lst[0]) #prints the number in postion 0 lst[1]=200 #updates the value in postion 1 print(lst) #next lst=[1,2,3,4,5] for num in lst: print(num) #o...
2379c88cf869f2090e5ee4fb76f2aad89e88c62c
sharonsabu/pythondjango2021
/oops/oops10.py
171
3.8125
4
#overriding class Parent: def phone(self): print("have nokia phone") class Child(Parent): def phone(self): print("iphone") ch=Child() ch.phone()
b8987727b1110837908500f6dbde1118729dffa0
sharonsabu/pythondjango2021
/looping/add.py
79
3.6875
4
#1+2+3+4+5 num=5 i=1 total=0 while(i<=num): total = total + i print(total)
c7493e84e56cb655239b66a209ec4950c5009a3d
hackhubs/operating-system-algorithms
/deadlock_detection.py
801
3.90625
4
def main(): print("Enter no. of processes:", end="") p = int(input()) print("Enter no. of resources:", end="") r = int(input()) print("Enter resource matrix:") resource_matrix = [] for _ in range(p): temp = list(map(int, input().split())) resource_matrix.append(temp[:r+1]) print("Enter allocation matrix:...
2d1f2202b63133823ad0df266f7ceaa8dba4246a
rchatti/DataEngineering
/dataflow/combine.py
887
3.609375
4
import apache_beam as beam """ Combine is a Beam transform for combining collections of elements or values in your data. - MUST provide the function that contains the logic for combining the elements or values. - The Combining function should be commutative and associative, as the function is not necessarily i...
c9da65feb5baaa463101fca0dd6ea3af172dc983
lanxingjian/Learn-Python-the-Hard-Way
/ex8.py
427
3.625
4
formatter = "%s %s %s %s" print formatter % (1,2,3,4) print formatter % ("one", "two", "three" ,"four") print formatter % (True,False, False, True) print formatter % (formatter, formatter, formatter, formatter) print formatter %( "I had this thing.", "That you could type up right .", "But it did not sin...
3b66cd079d10af6018cc90c45eacac8e52c053a6
sporttickets/Portfolio-programming
/deciding.py
212
4.25
4
#learning about if statements number = int(raw_input("enter your age\n")) if number < 15: print "you still are in middle school" else: print "you know everthing" if number < 5: print "you are not in school"
88efe98d225d8fcb8c5ab2366ade0c49c428b6d8
Stran1ck/python_mini
/exception.py
1,414
3.546875
4
def first_fanc(): n = int(input()) args = {} for i in range(n): x = input() if ' ' not in x: args[x] = '' elif ' ' in x: a = x.split() args[a[0]] = set(a[2:]) return args def exceptions(dict_main, exception_, result_list, value_list): if ...
9791a2d4328437a7e56e64686d7aa4de79693de5
Stran1ck/python_mini
/warrior.py
1,011
3.65625
4
class Warrior: health = 100 def setname(self, n): self.name = n def getname(self): try: return self.name except: print("No name") def kick(self, unit): unit.health -= 20 print(str(self.getname()) + ' атаковал.') print('У ' + unit...
67e2c579de8e8e922904b62430c053665c46a894
Stran1ck/python_mini
/1.py
167
3.578125
4
n = int(input()) c = 0 matrix = [] for i in range(n): a = [int(x) for x in input().split()] matrix.append(a) for i in range(n): c += matrix[i][i] print(c)
80cbe93fb457fb8a8058b1814750ebb40d1befe0
olemagnp/TDT4110-of-kode-P3-2018
/of4/factorial.py
166
3.8125
4
def factorial(x): product = 1 for i in range(1, x + 1): product = product * i return product y = factorial(12) print("Fakultetet av 12 er", y)
cd037f4c9f94f69e3dc30eac35cbbe7014a0dc45
olemagnp/TDT4110-of-kode-P3-2018
/of4/angry_speech.py
190
3.828125
4
def angry_speech(): speech = input("Hva vil du si?") speech = speech.upper() speech = speech + "!" return speech angry = angry_speech() print(angry) print(angry_speech())
9e48bb31958780e41cfdfaf8e3f8bd1ebe7fceb5
olemagnp/TDT4110-of-kode-P3-2018
/of5/Yatzee.py
572
3.734375
4
import random def roll_dice(): return [random.randint(1, 6) for i in range(5)] def roll_dice_manual(): dice = [] for i in range(5): dice.append(random.randint(1, 6)) return dice def num_with_vals(dice, value): total = 0 for die in dice: if die == value: total +=...
14f0020b191cc3b2a4adfe704e90555225ba6e18
olemagnp/TDT4110-of-kode-P3-2018
/of6/numeric_characters.py
627
3.734375
4
import random def letter_difference(letter_a, letter_b): return abs(ord(letter_b) - ord(letter_a)) def word_difference(word1, word2): total_diff = 0 for i in range(len(word1)): diff = letter_difference(word1[i], word2[i]) total_diff += diff return total_diff def print_sorted_word(...
35922738a93ff4f339d338ff541a5b15b39aa521
olemagnp/TDT4110-of-kode-P3-2018
/of2/sum_equals.py
188
4.15625
4
tall1 = int(input("Tall 1: ")) tall2 = int(input("Tall 2: ")) tall3 = int(input("Tall 3: ")) sum_equals = tall1 + tall2 == tall3 sum_equals2 = tall1 + tall3 == tall2 print(sum_equals)
2d7308d13f713b7c98492c3a8aa0a95a2aad0903
charliepoker/pythonJourney
/simple_calculator.py
876
4.25
4
def add(x,y): return x + y def Subraction(x,y): return x - y def Multiplication(x,y): return x * y def Division(x,y): return x / y operation = input(''' Please type in the math operation you would like to complete: + for addition - for subtraction * for multiplication / for division ''') num_1 = ...
77f5fe9c0172c1eecc723b682a3d2c82eda2918d
charliepoker/pythonJourney
/lists.py
2,340
4.40625
4
#list is a value that contains multiple values in an ordered sequence. number = [23, 67, 2, 5, 69, 30] #list of values assigned to number name = ['mike', 'jake', 'charlie', 'tim', 'dave', 'jane'] #list of values assigned to name print(name[2] + ' is ' + str(number[5]) + ' years old.') #lis...
6b1a9c6dfaf6f71b20779aafdf0439fe5930d931
riayulia/pythonsaya
/horror.py
614
3.90625
4
print ("Yuk main pilih pintu") pilih=input("Pilih 1 atau 2 ?") if pilih==1: print(" 1.Harta") print(" 2.Tahta") print(" 3.Wanita") pilih2=input("Pilih 1/2/3 ? ") if pilih2==1: print("Anda Kaya") print("Selesai") elif pilih2==2: print("Anda Raja") print("Selesai") ...
bcb1c0c9ff3531531039a84db6d3bf574f687ea1
plmqazoknijb/codingProject
/프로그래머스/05 행렬의 덧셈.py
205
3.625
4
def solution(arr1, arr2): answer = [0] * 2 answer = [answer] * 2 answer[0][0] = arr1[0][0]+ arr2[0][0] arr1 = [ [1,2], [2,3] ] arr2 = [ [3,4], [5,6] ] print(solution(arr1,arr2))
f90ea0b95ad84076fed0c02d64fb556869e1e11f
bodawalan/HackerRank-python-solution
/guess_game.py
659
3.96875
4
import random def guess_game(): guess_number = [] random_number=random.randint(0,6) count = 1 while True: user_input = int(input("guess the number between 1 to 5 '\t ")) guess_number.append(user_input) if random_number == user_input: print("You sucess fully match th...
726a379e1300884e923a09de40c7f8c1315a4d7b
bodawalan/HackerRank-python-solution
/countup.py
136
3.765625
4
start= int(input()) for i in range(1,11): print(start+1,'',end='') if i <10: print('then','',end='') start +=1
7d69e6f8ea4d417cc07edf45a145abf7b0e79cb4
bodawalan/HackerRank-python-solution
/Monday_day.py
231
3.84375
4
import datetime date_entry = input('Enter a date in YYYY-MM-DD format') year, month, day = map(int, date_entry.split('-')) today = datetime.date(year, month, day) print(today - datetime.timedelta(days=today.weekday(), weeks=0))
57e0d46944297b0a2fb239e87091198d989e08e7
bodawalan/HackerRank-python-solution
/inheritance.py
1,238
3.765625
4
class Person: def __init__(self,firstName,lastName,idNumber): self.firstName=firstName self.lastName=lastName self.idNumber=idNumber def PrintPerson(self): print("Name:", self.lastName + " ," , self.firstName) print("ID:", self.idNumber) class Student(Person): def ...
2ea7c20e4dcbbdcbf54fd439b51bbb6419d5b7f1
bodawalan/HackerRank-python-solution
/numstring.py
276
3.8125
4
class NumString: def __init__(self,value): self.value=str(value) def __str__(self): print( self.value) def __int__(self): print( int(self.value)) def __float__(self): print( float(self.value)) five=NumString(5) print(str(int))
0211c3fa0ff36391c2394f1ea8973d07d4555c87
bodawalan/HackerRank-python-solution
/cdk.py
2,845
4.3125
4
# Q.1 # # Write a function that takes as input a minimum and maximum integer and returns # all multiples of 3 between those integers. For instance, if min=0 and max=9, # the program should return (0, 3, 6, 9) # # A # you can type here def func(min, max): for in xrange(min, max): if (i % 3 == 0) ...
a5389bd46968e2b8ef222cd835a12b663f2ceca9
bodawalan/HackerRank-python-solution
/if_else.py
436
3.84375
4
"""print("hello") n= 18 if n % 2 == 0: if 3<= n <=6: print("weirdl1") elif 6<= n <= 20: print ("not weird") elif n >20: print("weirdl") else: print ("odd") n = int(input()) integer_list = map(int, input().split()) t=(n,integer_list) print(hash(t)) find second largest element"""...
9285539de0791586044cd7d7f766460d1c77522d
bodawalan/HackerRank-python-solution
/Lonely_Integer.py
592
3.84375
4
"""def duplicatearray(arr): nosupl=[] for i in arr: if i in nosupl: pass else: nosupl.append(i) print(nosupl) new=duplicatearray([1,2,3,4,4,5,6,3])""" num_in=int(input("how many number of input you want?")) num_in_list=[] for i in range(num_in): num_in_list.ap...
af930f414302be549f6c33dadc6330047e4e657f
rui725/rui-portf
/practices/python/p1.py
236
3.59375
4
__author__ = 'Rui Rafael Rosillas' def inst(name): user = '*.:*|'+name+'|*:.*' pat ='' for n in range(0,user.__len__()): pat +='*' print '\n\n\n\n\nBanner By '+__author__+'\n'+pat+'\n'+user+'\n'+pat print 'Write your name:' inst(raw_input())
13ee11257da13493b65fd71c7ac4d55d6c1ac140
nevaermorr/PyGue
/engine/spatial.py
5,707
3.796875
4
from utilities.general_functions import * class Spatial(): """ any element placed in the space """ def __init__(self, x, y): # horizontal coordinate self.x = x # vertical coordinate self.y = y def get_x(self): """ obtain coordinate from x-axis ...
2bec64ae1b141326498bcea882441bdc2dee6bff
abhi05111996/Smart-Calculator
/mathy.py
1,358
3.625
4
responses =["Welcome to my page","My name is abhi","Thank you to visit my page","Sorry, this is beyondmy ability","I am good","Abhishek singh"] def extract_numbers_from_text(text): l=[] for t in text.split(' '): try: l.append(float(t)) except ValueError: pass return(...
825b24bad09311d45f687800b15b7dfd58931cc0
HGunther/Neural-Net
/Example_Ten_Class.py
1,980
3.53125
4
"""Example code using my neural net on the 10 class, MNIST dataset.""" from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt import numpy as np import matplotlib as matplotlib import Functions as F import NeuralNet as NN import math as math # Data prep mnist = input_data.read_data_...
66d89e1d6556274b2f15443f31ada79bd1959962
paprockiw/traverse
/find_element.py
1,550
3.671875
4
def find_element(json, path): ''' Takes dumped JSON and path to item nested within it, returns the nested items as a generator. ''' key = path[0] if len(path) == 1: if key == '*': for item in json: try: yield item except Exc...
58167d79107dde5672d6891c496478c7cb93a7f3
Mahmoud-alzoubi95/pythonic-garage-band
/pythonic_garage_band/pythonic_garage_band.py
2,582
4
4
from abc import abstractclassmethod from abc import abstractclassmethod class Musician: members = [] def __init__(self,name): self.name = name Musician.members.append(self) @abstractclassmethod def __str__(self): pass @abstractclassmethod def __repr__(self)...
32ade0a68335fd541d466293863f5e411610fca1
jcharlottef/python-playground
/Python-Playground/veggies.py
607
4.0625
4
# by jonathan hudgins and jackie faselt import csv vegetables = [ {"name": "eggplant", "color": "purple"}, {"name": "tomato", "color": "red"}, {"name": "corn", "color": "yellow"}, {"name": "okra", "color": "green"}, {"name": "arugula", "color": "green"}, {"name": "broccoli", "color": "green"}, ] # 1. Loops th...
2525330d74ff0b5b8826e74739634199275ba9f4
phoebetwong/dc_ds_06_03_19
/module_1/morning_warm_up/week_1/mywork_warmup3_pw.py
2,607
3.765625
4
#!/usr/bin/env python # coding: utf-8 # # Pandas and numpy - pair-up # ### Discussion session # # 1. How will you read the following data into a pandas data frame ? # ` ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_mm_mlo.txt` # In[94]: import pandas as pd import numpy as np table = pd.read_csv("co2_2.csv", h...
be21e2659d8564663b78934d15ff847823048038
jpryan1/stress-test
/wave.py
2,248
3.671875
4
##################################### ## Wavelet Generator ## Written by John Ryan - jpr349@nyu.edu ## ## ## The following are methods for generating 2D Morlet Wavelets ## ## To get an array of size N of the 2D Morlet Wavelet ## with sigma S and theta T, call ## wave = np.array( wavelet(S, T, N) ) ## To convolve...
c9cb5f0f3f8ebe7185fe1566765cf845bbfe74e3
jordanlee008/Code
/BWSI/MachineLearning_01_HW/student.py
3,647
3.84375
4
from urllib import request import numpy as np import os __all__ = ['NearestNeighbor', 'load_cifar10', 'validate_shapes'] class NearestNeighbor(object): def __init__(self): pass def train(self, X, y): """ X is N x D where each row is an example. Y is 1-dimension of size N """ # th...
07969f835c57729793df401fc7e367e4e6d399a6
dodieboy/Np_class
/PROG1_python/coursemology/Mission32-CaesarCipher.py
1,288
4.71875
5
#Programming I #################################### # Mission 3.2 # # Caesar Cipher # #################################### #Background #========== #The encryption of a plaintext by Caesar Cipher is: #En(Mi) = (Mi + n) mod 26 #Write a Python program that prompts user to enter ...
dd7eaba53e6e3759b0e119a38eaa18ba829bda03
dodieboy/Np_class
/PROG1_python/coursemology/Mission32-EnergyCostCalculator.py
4,823
4.75
5
#Programming I ####################################### # Mission 3.2 # # Calculate Daily Total Energy Cost # ####################################### #Background #========== #The total energy cost is calculated using this formula: #Total Energy Cost ($) = Total Energy consumed (kW) x 0.2356 ...
03396cc7b38b7a779ca33d376a6ccb33720289b0
dodieboy/Np_class
/PROG1_python/coursemology/Mission72-Matrix.py
1,081
4.25
4
#Programming I ####################### # Mission 7.1 # # MartrixMultiply # ####################### #Background #========== #Tom has studied about creating 3D games and wanted #to write a function to multiply 2 matrices. #Define a function MaxtrixMulti() function with 2 parameters. #Both parameters are in ...
0c22d989affb8c0f822942a68d5ad2c52652fff9
zekeyang/inf1340-2015-labs
/lab4.py
1,774
3.890625
4
#!/usr/bin/env python3 """ Graded Lab #4 for Inf1340, Fall 2015 This program computes federal and provincial sales tax. Assume that the provincial sales tax is 5 percent and the federal sales tax is 2.5 percent. It displays the amount of the purchase, the provincial sales tax, the federal sales ta...
ce67ac920d11f1038c8589451a2246e9c899105c
aiceboy/assignment8berg
/tiles.py
763
4
4
#Heldur utan um stöðu player #Prentar möguleika def prints_options(): print('You can travel' + str()) #Taka input um hvað user vill gera print('Lol') direction = input("where do you want to go ?") x = 1 y = 1 def direction(): take_direction = input('Direction: ') return take_direction def movemen...
32782b4acb19488c63aca9748879692cf3924f28
icomam/100-day-coding
/DAY14,15.py
2,748
4.03125
4
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> thislist=["A","B","C","D","E"] >>> print(thislist[1:3]) ['B', 'C'] >>> if "A" in thislist: print("Yes,A is in the list") Yes,A is in...
9b6f5f6fc8e2302fb9fecae250faa9a7e90aa463
icomam/100-day-coding
/DAY13.py
2,264
3.75
4
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> S=[] >>> print(S) [] >>> numbers=[1,2,3,4,5] >>> print(numbers) [1, 2, 3, 4, 5] >>> thislist=["apple","banana","cherry"] >>> print(thisl...
147e6b3ac517788e0cd02cb2f009e531fbe4b81f
hchung11/AI
/uninformedSearch(ex)-1.py
4,294
3.5
4
import Queue try: bfsDfs = int(raw_input("Choose shearch \n 1) BFS \n 2) DFS \n >>>>>>")) print "Row\Colmn 0 1 2 3 4 5 6 7" with open("textFile.txt") as f: for value, l in enumerate(f) : print " ",value," ", l start = int(raw_input("Choose Start...
d789acc3e3c58bfac81647e0084ccfbab87630ae
jttsai99/BattleShipAI
/BattleShip/src/players/human_player.py
6,356
3.546875
4
from typing import Dict, List import copy from BattleShip.src import game_config, board, ship, orientation, ship_placement, move from BattleShip.src.firing_location_error import FiringLocationError from .player import Player class HumanPlayer(Player): #change it to HumanPlayer(Player) when you want to change it op...
c3ba57ea7ad83b5819851bafb7e88d62cd267c8d
jason-neal/Euler
/Completed Problems/Problem 5-smallest_multiple.py
641
4.15625
4
"""Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ import numpy as np def smallest_multiple(n): """Smallest multiple of numbe...
ef4b85e598605a1a4813e55682f499f9d11d791a
peterle-dev/barchartutorial
/barchartss.py
1,241
3.59375
4
import csv import numpy as np import pandas as pd from collections import Counter from matplotlib import pyplot as plt # importing pyplot from matplotlib # plt.xkcd() # builds the plot as comic theme. data = pd.read_csv('data.csv') ids = data['Responder_id'] lang_responses = data['LanguagesWorkedWith'] language_cou...
5a5df89021615fe5b2f25d6b99a4b2c32aefc733
tarosukdeo/PolynomialRegression
/poly.py
1,670
3.9375
4
import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures #In general within the work force, the more work experience an employee has, #the greater the salary they would receive over time. In this model, I will be #e...
78ba21a6494d1f1f0eec231ddff2268a586cc37d
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/zeros_to_back.py
798
3.96875
4
""" Write a program that receives a single string (integers separated by a comma and space ", "), finds all the zeros and moves them to the back without messing up the other elements. Print the resulting integer list """ # index = 0 # for i in range(len(num_str)): # if len(num_str) > 1: # if num_str[i] == ...
227d529eaf47f959665614bb12d3edaa322d1a38
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/07_Dictionaries/force_book.py
653
4
4
sides = {} while True: line = input() if line == "Lumpawaroo": break if "|" in line: args = line.split(" | ") side = args[0] user = args[1] if side not in sides: sides[side] = [] if user not in sides[side]: sides[side].append(user) else: args = line.sp...
cbc97978dbafa655d385b6741d6c046cb648cff4
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/4_Conditional_Statements/fruit_or_vegitable.py
386
4.34375
4
product_name = input() if product_name == 'banana' or product_name == 'apple' or product_name == 'kiwi' or product_name == 'cherry' or \ product_name == 'lemon' or product_name == 'grapes': print('fruit') elif product_name == 'tomato' or product_name == 'cucumber' or product_name == 'pepper' or product_nam...
0569f8f4243c3694a236fd8daf00171893d8666c
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/03_Basic_Syntax_Conditions_Loops/maximum_multiple.py
397
4.1875
4
''' Given a Divisor and a Bound, find the largest integer N, such that: N is divisible by divisor N is less than or equal to bound N is greater than 0. Notes: The divisor and bound are only positive values. It's guaranteed that a divisor is found ''' divisor = int(input()) bound = int(input()) max_num = 0 for i in ra...
e5d235f79d15a16df0f93752e6f97ad333b28d30
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Advanced/lists_as_stacks_and_queues/demo.py
374
3.546875
4
from collections import deque # # 0, 1, 2 linear data structure # l = [1, 2, 3, ] # # print(l) # l.append(5) # print(l) # # # l.insert(1, -777) # print(l) # # l.pop() # print(l) # # # dynamic size # # grow # # shrink # # random element access # # first # # middle # # last # # bullets = deque(map(int, input().split...
8fbebf0dc2580ea73e30de06f9e1c82a07eb2358
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/5_While_Loops/max_number.py
191
3.515625
4
import sys n = int(input()) i = 0 number = -sys.maxsize while i < n: current_number = int(input()) if current_number > number: number = current_number i += 1 print(number)
ff1bf1a281269795e3a5c74c65e659859b0ac149
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/02_Data_Type/print_part_of_the_ascii_table.py
159
3.6875
4
line1 = int(input()) line2 = int(input()) result = '' for i in range(line1, line2 + 1): result += chr(i) + ' ' print(result) # print(chr(i), end=' ')
4f223e55d200b43c4245e8a34ec4acd7a1a0e7dd
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/numbers_filter.py
615
3.9375
4
lines = int(input()) my_list = [] filtered = [] for _ in range(lines): number = int(input()) my_list.append(number) command = input() if command == 'positive': for number in my_list: if number >= 0: filtered.append(number) elif command == 'negative': for number in my_list: if...
8cef3fd7c3a14eb83f44552491696d9b3a566471
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Advanced/File-Handling-Exercise/03_FileManipulation.py
1,471
3.890625
4
import os def create_file(file_name): if os.path.exists(file_name): os.remove(file_name) with open(file_name, 'x'): pass def append_line_to_file(fine_name, line): with open(file_name, 'a') as file: file.write(f"{line}\n") def replace_string_in_file(file_name, old_string, new_s...
3488366694f3b9971b0583f8e4693d6243778809
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/hello_france.py
3,431
4.25
4
""" The budget was enough to get them to Frankfurt and they have some money left, but their final aim is to go to France, which means that they will need more finances. They’ve decided to make profit by buying items on discount from the Thrift Shop and selling them for a higher price. You must help them. Create a prog...
f44f5526c9bdaf4e7e95452402c6ebb4cc731528
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/7_Nested_Loops/equal_sums_even_odd_position.py
476
3.65625
4
n1 = int(input()) n2 = int(input()) current_index = 6 for current_number in range(n1, n2 + 1): copy_number = current_number even_sum = 0 odd_sum = 0 while current_number > 0: last_digit = current_number % 10 if current_index % 2 == 0: even_sum += last_digit else: ...
5b3145219fbf8802f747d84079e0c4ca2099a4a8
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/4_Conditional_Statements/number_100_200.py
587
4.15625
4
""" Conditional Statements - Lab Check: https://judge.softuni.bg/Contests/Practice/Index/1012#0 06. Number 100 ... 200 Condition: Write a program that reads an integer entered by the user and checks if it is below 100, between 100 and 200 or over 200. Print messages accordingly, as in the examples below: Sample input a...
fc8c286f691360c9b96b4c91fa3fabeccade2aac
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/bread_factory.py
2,805
4.3125
4
""" As a young baker, you are baking the bread out of the bakery. You have initial energy 100 and initial coins 100. You will be given a string, representing the working day events. Each event is separated with '|' (vertical bar): "event1|event2|event3…" Each event contains event name or item and a number, separated b...
b33be4ce78fa753475572d9f5cf66064e9e03897
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/07_Dictionaries/stock.py
1,640
3.953125
4
# d = {"a":1, "b":4, "c":9} # # # for key in d.keys(): # # print(key, end=' ') # # # # # for key in d.keys(): # # d[key] **= 2 # # print(d) # #tuple deconstruction # # for key, value in d.items(): # print(f"Key: {key}, Value: {value}") # # if 4 in d.values(): # print('4 is a value in my dictionary')...
a2c76c5bf62ba860aa949aa84c1d6c5f141bc04c
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/01_Conditional_Statements/maximum_multiple.py
144
3.75
4
divisor = int(input()) bound = int(input()) max_num = 0 for i in range(1, bound+1): if i % divisor == 0: max_num = i print(max_num)
a762391e60e672bc12bd54fa3aefa18a0c8da076
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/02_Data_Type/sum_of_chars.py
145
3.8125
4
lines = int(input()) total_sum = 0 for i in range(lines): letter = ord(input()) total_sum += letter print(f'The sum equals: {total_sum}')
624f250400c8ec1768525b8f29adf2a2b23f22f1
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Advanced/Tuples-Sets/4_ParkingLot.py
493
3.625
4
n = int(input()) parking_lot = set() def get_into_parking(plate_number): parking_lot.add(plate_number) def get_out_parking(plate_number): if parking_lot: parking_lot.remove(plate_number) for _ in range(n): action, plate_number = input().split(', ') operations = { 'IN': get_into_pa...
b4bb635ae844e30f8fd58d64eeab5adda17726b2
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/04.Search.py
1,153
4.3125
4
""" Lists Basics - Lab Check your code: https://judge.softuni.bg/Contests/Practice/Index/1724#3 SUPyF2 Lists Basics Lab - 04. Search Problem: You will receive a number n and a word. On the next n lines you will be given some strings. You have to add them in a list and print them. After that you have to filter out only ...
5fc56d9d02475b497d20988fbe8a244faec680e9
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/2_simple_calculations/Projects_Creation.py
762
4.3125
4
""" Simple Operations and Calculations - Lab 05. Creation Projects Check: https://judge.softuni.bg/Contests/Compete/Index/1011#2 Write a program that calculates how many hours it will take an architect to design several construction sites. The preparation of a project takes approximately three hours. Entrance 2 lines a...
5cffe19937da31ebf38218f071d94e92e8d42fd4
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/4_Conditional_Statements/animal_type.py
546
4.03125
4
""" Conditional Statements - Lab Check: https://judge.softuni.bg/Contests/Practice/Index/1012#0 11. Animal Type Condition: Write a program that prints the class of the animal according to its name entered by the user. -dog -> mammal -crocodile, tortoise, snake -> reptile -others -> unknown Sample input and output Input...
f0c0f799692e9983eff9eac00376cb310ef2d7d2
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Basics/4_Conditional_Statements/godzilla_vs_kong.py
536
3.671875
4
movie_budget = float(input()) extras_count = int(input()) outfit_price = float(input()) scene = movie_budget * 0.1 outfit_total = extras_count * outfit_price discount = outfit_total * 0.1 if extras_count > 150: outfit_total = outfit_total - discount difference = abs(movie_budget - outfit_total - scene) if scene...
76307f5ed5371827899690b6221c648b4a989253
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Advanced/Comprehension/demo_1.py
147
3.53125
4
def addTwoDigits(n): str_n = str(n) tokens = [int(x) for x in str_n] return tokens[0] + tokens[1] res = addTwoDigits(29) print(res)
7a0f501b6baa7928d2426bf9be99fff2aa785fad
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/05_Functions/paper_doll.py
324
3.90625
4
def paper_doll(text): string = [] for i in range(len(text)): new_text = text[i] * 3 string.append(new_text) out = ''.join(string) print(out) return out def paper_doll_concat(text): result = '' for char in text: result += char * 3 return result paper_doll(inpu...
26abef2f5bf72a462839a2696aa9848746c5435e
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/02_Data_Type/biggest_of_three_nums.py
154
4.15625
4
import sys biggest_num = - sys.maxsize for num in range(3): num = int(input()) if num > biggest_num: biggest_num = num print(biggest_num)
b0e20c859c4c65478d955ee75ec04bbf2c0a370a
stevalang/Coding-Lessons
/SoftUni/Python Developmen/Python-Fundamentals/04_Lists/number_filter.py
1,173
4.1875
4
""" Lists Basics - Lab Check your code: https://judge.softuni.bg/Contests/Practice/Index/1724#4 SUPyF2 Lists Basics Lab - 05. Numbers Filter Problem: You will receive a single number n. On the next n lines you will receive integers. After that you will be given one of the following commands: • even • odd • negative • p...