blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
bcf2fee9bf1b50855607e2b748080ad319468f7b
pBouillon/codesignal
/arcade/intro/9_Eruption_of_Light/Is_MAC48_Address.py
1,343
4.53125
5
""" A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits (0 to 9 or A to F), separated by hyp...
c17719db8ae21f8174e7a4526c9f0e71eb92d32a
pBouillon/codesignal
/arcade/python/5_Fumbling_In_Functionnal/Fix_Result.py
1,332
4.125
4
""" Your teacher asked you to implement a function that calculates the Answer to the Ultimate Question of Life, the Universe, and Everything and returns it as an array of integers. After several hours of hardcore coding you managed to write such a function, and it produced a quite reasonable result. However, when y...
4e9b8c6774cc035baebf1ebd959f0d2c36c21c43
pBouillon/codesignal
/arcade/intro/5_Rains_of_Reason/chessBoardCellColor.py
991
3.984375
4
""" Given two cells on the standard chess board, determine whether they have the same color or not. Example For cell1 = "A1" and cell2 = "C3", the output should be chessBoardCellColor(cell1, cell2) = true. https://codefightsuserpics.s3.amazonaws.com/tasks/chessBoardCellColor/img/example1.png?_tm=149433856...
d93215df09999419db4bab6bc4f8eb39b2aeb127
pBouillon/codesignal
/arcade/python/6_Caravan_of_Collections/Unique_Characters.py
939
4.28125
4
""" You need to compress a large document that consists of a small number of different characters. To choose the best encoding algorithm, you would like to look closely at the characters that comprise this document. Given a document, return an array of all unique characters that appear in it sorted by their ASCII ...
69880fc2173e8aa9268b24f3de02100508b6cd45
zhongshun/Leetcode
/83. Remove Duplicates from Sorted List/solution.py
720
3.734375
4
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ h = head while head and head....
9e19488407f90ac9b64a734dcc4a9039c08c5e16
zhongshun/Leetcode
/979. Distribute Coins in Binary Tree/solution 1.py
761
3.890625
4
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def distributeCoins(self, root): """ :type root: TreeNode :rtype: int """ self.ans = 0 ...
e9cff2d0be4618700e9c1d27354df6b7040a9aad
zhongshun/Leetcode
/576. Out of Boundary Paths/solution 1.py
783
3.546875
4
class Solution(object): def findPaths(self, m, n, N, i, j): """ :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int """ self.DP = {} def sumPath(m,n,N,i,j): if (i,j,N) in self.DP: ret...
057154fabf05b6deed7d27508c9e1954c1569012
zhongshun/Leetcode
/74. Search a 2D Matrix/solution 1.py
886
3.84375
4
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ def FindinRow(row, target): i = 0 j = len(row) - 1 while i <= j: if row[i] < targe...
62e0955d3c9bd5b770835a68324507cd550d8beb
zhongshun/Leetcode
/74. Search a 2D Matrix/solution 2.py
541
3.671875
4
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ i = 0 j = len(matrix) while i < j: if matrix[i][-1] < target: i += 1 if matrix...
c19bb2cd41b39d28265db631c6516e3e9aab682a
zhongshun/Leetcode
/120. Triangle /solution.py
530
3.5625
4
class Solution(object): def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ def currentMin(triangle,i,j): if i == len(triangle) - 1: return triangle[i][j] else: return triangle[i][j] + ...
a0ad662ed69b24969787b61545d01bb2d1489cee
zhongshun/Leetcode
/53. Maximum Subarray/solution 2.py
417
3.546875
4
class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 currmax = summax = nums[0] for num in nums[1:]: currmax = max(num,currmax + num) summax = max(summax,currmax) ...
21bee712b7bb283de70e72d243aa71b99ad9ad31
zhongshun/Leetcode
/101. Symmetric Tree/solution 2.py
584
3.796875
4
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isSymmetric(self, root): """ :type root: TreeNode :rtype: bool """ def CompareLeftRight(Left,Right): if not Left...
c74785827938751410f2ca78676c167697e02ce5
digitalcourtney87/lpthw
/ex3.py
972
4.625
5
# prints the string "I will now count my chickens:" print("I will now count my chickens:") # prints hens and roosters and the calculation after each string print("Hens", 25 + 30 / 6) print("Roosters", 100 - 25 * 3 % 4) # prints the string "I wil now count my eggs" print("I will now count my eggs:") # prints the calc...
9df14f74108e3ab76fb93d4d8b26d0db8d038169
ZachAnders/Python-to-x86-asm
/tests/HW5/bubbleSort.py
955
3.859375
4
def bubbleSort(l, length): def issmallerthan(or1,or2): x = lambda s1, s2: x(s1 + -1,s2 + -1) if s1 != 0 and s2 != 0 else [or1,or2] if s1 == 0 else [or2,or1] return x(or1,or2) def loop1(l, length, i): l = l if i == length else loop2(l,length-i,0) return l if i == length else loop...
1b171733d58df84a0a96783bc4a9f3e601987918
ZachAnders/Python-to-x86-asm
/tests/HW6/check.py
118
3.5625
4
def check(x): if x: print True else: print False x = 25 check(x) y = -25 check(y) check(x+y)
65fe9cac4ce60eca47a8da146b57d82b462aa653
rianadon/Emoji-Suggester
/emojiserver/emojiserver.py
3,489
3.53125
4
""" This program spawns an HTTP server that serves relevant emojis based on the request path. """ import json from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import parse_qs, urlparse import numpy as np import emojilib import word2vec NUM_EMOJIS = 10 # Number of emojis to ...
589f7e7245dae5d5110bfca293a48f6d98f2435c
DiegoCC14/Algoritmos_de_Ordenamiento
/MergShort.py
1,433
3.65625
4
from linkedlist import * def OrdenaListas(ListaIzquierda,ListaDerecha): #Dada 2 listas ORDENADAS genera una lista nueva ordenada currentnode2 = ListaDerecha.head while ListaIzquierda.head!=None: currentnode1 = ListaIzquierda.head #Apunta al primer elemento de la lista currentnode2Anterior = None whi...
f08e3ecc0b793d238a1f81c2288b5af137b79397
allenmrazek/super-mario
/entities/entity.py
1,644
3.796875
4
from abc import ABC, abstractmethod from pygame.sprite import Rect from util import copy_vector from util import make_vector import constants class Entity(ABC): """Important note: while you can make things exist on the map by making them entities, they WILL NOT BE SERIALIZED. Use LevelEntity for persistent th...
6fb873bf7ee4c4b2b20e340056409f97e325f691
mateusmarinho/afrodev2-python
/aula100421/Exercicio08.py
572
3.984375
4
'''Fazer um algoritmo para imprimir a tabuada do valor inserido''' def is_int(valor): try: int(valor) except: return False return True if __name__ == '__main__': valido = False while not valido: valor = input('Digite um valor para calcular a tabuada: ') if is_int...
b79d6410b9ff6e269e3795642d75e8d4ea741504
mateusmarinho/afrodev2-python
/aula070421/Exercicio.py
2,431
3.921875
4
'''◦Somar 2 números e dividir por um terceiro ◦Verificar se o terceiro é diferente de 0 ◦Verificar se primeiro valor é maior que 10 ◦Verificar se resultado é menor que 4''' def askInt(text): while True: try: n = int(input(text)) except: print('Valor inválido! Digite um nú...
2e9904a72c784bd828c158e0ecd4918c5520c989
Ashwintlp/CD-Mini-Project
/lexical_analyser.py
3,333
3.546875
4
import re import io keywords=["int","void","main","print"] operators = { '=': 'Assignment Operator','+': 'Additon Operator', '-' : 'Substraction Operator', '/' : 'Division Operator', '*': 'Multiplication Operator'} optr_keys = operators.keys() symbols = {';':'semi_colon','{' : 'left_brace', '}':'right_brace'...
55cdf3f14d60cca95b019259d28a2f9bb6af0cd4
sisco0/sann-pq
/classifier.py
3,156
3.640625
4
import tensorflow as tf from tensorflow.python.keras.models import Sequential from tensorflow.python.keras.layers import * import numpy as np import random """Prepares and executes classification of power quality disturbance signals by using a one-dimensional convolutional neural network model.""" class classifier: ...
13f07c9b22f04784db4c1a399a5d54d3fe56e56f
jamincen/Python3X_Daily_question
/18_iterator_generator_yeild.py
641
3.578125
4
# iterable arr = [1, 2, 3, 4] # list string files dict set for i in arr: print(i) # generator # change [] to () gener = (i ** 2 for i in range(10)) for i in gener: print(i) # gener 只是一个对象,不会占用太多内存空间 # yield 相当于返回一个生成器,程序不会结束 # seem to return def m(): print('m() starting') while ...
f64c77c65741ef75db8bab6200a1714c05ac954e
jamincen/Python3X_Daily_question
/24_simple_operation_of_strings.py
1,390
4.5
4
""" 字符串的三种表达方式 . single quotes ' . double quotes " . three quotes ''' # multi-line string """ ## 拼接字符串的方式 a = 'hello' b = 'world' print(a + ' ' + b) print(a, b) print('%s %s' % (a, b)) # 推荐,效率高 print('hello''world') print('{}{}'.format(a, b)) # 推荐,效率高 print(''.join(['h...
b90ac72e21a548ca12be2a6ad31fef13b871af36
962245899/t08Maira-Sandoval
/trabajo04.py
1,038
3.515625
4
# 10 20 30 40 50 60 70 # 01234567890123456789012345678901234567890123456789012345678901234567890 msg="el verdadero discipulo es el que supera al maestro (aristoteles)" #indexacion print(msg[14]) #impresion de la letra "i" print(msg[51]) #impresion del sign...
631f7e49c123cb092c025a16035ee786224b0f1e
962245899/t08Maira-Sandoval
/trabajo8.py
1,169
3.609375
4
# 10 20 30 40 50 # 012345678901234567890123456789012345678901234567890123 msg="CUANDO ENTENDERAS QUE MIENTRAS MAS TOMAS, MENOS TIENES" #indexacion print(msg[35]) #impresion de la letra "T" print(msg[36]) #impresion de la letra "O" print(msg[37]) #impresion de la letra...
9bf8eb16bd1ab5f8f3291854dca7b63552df9805
962245899/t08Maira-Sandoval
/trabajo07.py
1,069
3.6875
4
# 10 20 30 40 50 60 70 80 # 012345678901234567890123456789012345678901234567890123456789012345678901234567890 msg="las raices de la educacion son amargas, pero el fruto es dulce (aristoteles)" #indexacion print(msg[35]) #impresion de la letra "g" prin...
2ff3e1966a4268c86f7fbcc8c42f6d36d2fcd151
SoftwareDevEngResearch/SRMspinanalysis
/SRMspinanalysis/sizing.py
1,909
3.625
4
def compute_total_impulse(spin_rate, roll_inertia, radial_distance): """Computes total impulse required to spin rocket at desired rate. `PEP 484`_ type annotations are supported. If attribute, parameter, and return types are annotated according to `PEP 484`_, they do not need to be included in the docs...
ee50e8af4386cf06507bdfa27360452e72d2fd2d
JosephLudena/python-base-08-2019
/hw_2.py
308
3.859375
4
print("Вычисление площади треугольника по формуле Герона") a=float(input("сторона a ")) b=float(input("сторона b ")) c=float(input("сторона c ")) s=float(a+b+c)/2 area=float(s*(s-a)*(s-b)*(s-c))**(1/2) print("площад:", str(area))
c9a1bb607d557d4a7b2e81943b527778cfb3f2df
rogerferrod/tln
/tln_dicaro/src/Hanks/DependencyGraph.py
2,879
3.53125
4
__author__ = 'Roger Ferrod' import re class DependencyGraph: """ Class representing the dependency graph of a sentence. the syntactic parser supplies a list of edges labeled with the dependency example: 2 -> 6[label='nmod'] and a list of nodes labeled with the corresponding word in the senten...
63cf20d96eff8cf98cde846eb497b7735356c1f4
learn-cloud/cisco
/EE/api.py
148
3.828125
4
a = 10 b = 20 c = a+b print('------------------------------') print ("adittion of two numbers is: ",c) print('------------------------------')
12ed0950c189274540df3f9d6b06e3a63eeb7f6b
asadiyan/learning-python
/simple-examples/map.py
430
3.921875
4
def add(x): return x + 2 myList = [10, 20, 30, 40, 50] result = list(map(add, myList)) # when we use lambda then we dont need the function add(). result = list(map(lambda x: x + 2, myList)) print(result) prices = [100, 56, 28, 34, 50] def discount(x): return x - (x * 10) / 100 print("prices without an...
08db5728d17bef9d07f1a43ba6a4cef96e3b7218
asadiyan/learning-python
/tkinter-examples/messagebox-tkinter.py
372
3.921875
4
import tkinter import tkinter.messagebox root = tkinter.Tk() tkinter.messagebox.showinfo("title", "this is awsome") response = tkinter.messagebox.askquestion("question1", "do you like coffe?") if response == "yes": tkinter.messagebox.showinfo("yessss", "here is your coffe on me!") else: tkinter.messagebox.s...
272b196377720ebed07ce62c0d3f6e7b73d90675
asadiyan/learning-python
/simple-examples/starMetaCharacter.py
302
3.953125
4
import re pattern = r"eggs(bacon)*" if re.match(pattern, "eggsbacon"): print("match found") """when we have star character in there that meanes: the word or group of bacon: can be in the pattern and it cant be it doesn`t matter at all, just for bacon not esggs, eggs should be in the pattern"""
855f3a9067e98ba8f6bfe85bf5ac29050a82c60a
PrestonPhelan/AlgorithmsAndDataStructuresPractice
/CrackingTheCodingInterview/03StacksAndQueues/3_6.py
5,180
4.125
4
# Animal Shelter ### OUTLINE #### # Main Queue # Doubly-Linked List, due to need for accessing non-first elements # Species Queues # Normal queues ####################### ## Basic Class Definitions # Linked List node class class DoublyLinkedListNode(object): def __init__(self, value=None): if val...
d6c30761070ce055f4a7bed9060d6c9df4ef7947
ehjivh/study01
/kokok.py
300
3.5
4
import Tkinter counter = 0 font = ("Helevetica", 32, "bold") button = Tkinter.Button(font=font, text=str(counter)) def clicked(): global counter, button counter = counter + 1 button.config(text=str(counter)) button.config(command=clicked) button.pack() button.mainloop()
153bffb9eab8ea2d4171af8d86855188b7ca3546
Roman-Cernetchi/ICS3U-Unit1-04-Python
/basic_math.py
386
3.734375
4
#!/usr/bin/env python3 # Created by: Roman Cernetchi # Created on: November 2020 # This program does basic math def main(): #this function deos basic math print(9+2) print("12-3={}".format(12-3)) print("12/3={}".format(12/3)) print("3+6/2={}".format(3+6/2)) print("3+6*2={}".format(3+6*2)) ...
402495f8873a041ae1b82f1e38aac13c5bd845c4
EvelynChee/Public-Transportation-Planning-with-RL
/network.py
9,252
3.53125
4
import tensorflow as tf class ActionValueEstimator(): """Action-value Function approximator. Given a representation of the environment, returns estimated values over the two actions of the state. Args: learning_rate (float): Learning rate used by optimizer. num_input (int): Size of the state...
4ab4e37a28b34eca99c61a172c55f038420712cc
Server1567/Piedra-Papel-o-Tijera
/RPS.py
1,981
4.03125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- from random import randint # Variables globales f1, f2, f3, F1, F2, F3 = None print ' ' print '------------------PIEDRA, PAPEL O TIJERA---------------------' print ' ...
13bf0659fb806ef6eb95384e5eba10a80c0fc51a
sarpong4/ICPP
/20.py
2,192
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 18 10:41:33 2018 @author: michael """ # 20 | Conditional Probability and Bayesian Statistics #%% # Finger exercise: given a normal distribution, we can see that the probability of being above 180 is P(within 1 std Dev) + p(above 1 std dev (positi...
8a9bbca969006facd085a01e77414c884ce1960d
sarpong4/ICPP
/2.3.py
343
3.640625
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 17 09:23:09 2018 @author: Dr. Neptune """ # 2.3 Strings and Input # length len('abc') # Indexing 'abc'[0] # a 'abc'[-1] # c # slicing 'abc'[1:3] # bc # input name = input('Enter your name: ') n = input('Enter an int:') # type conversions, or...
b9179ec88b474b752e55b1f5d3edb81fdb5d1ccb
sarpong4/ICPP
/Python/4.1.py
1,651
3.765625
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 17 11:28:06 2018 @author: Dr. Neptune """ # 4.1 | Functions and Scoping # Bisection search to approximate square root x = 25 epsilon = 0.01 numGuesses = 0 low = 0.0 high = max(1.0, x) ans = (low + high)/2.0 while abs(ans**2 - x) >= epsilon: numG...
85f867dd3bba7e82b150f820feeee5afa649a8c7
sarpong4/ICPP
/7.1.py
1,968
3.828125
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 31 12:02:24 2018 @author: Dr. Neptune """ # 7.1 | Handling Exceptions #%% numSuccesses = 10 numFailures = 10 successFailureRatio = numSuccesses / numFailures print('The success / failure ratio is', successFailureRatio) print('Now here') #%% instead ...
14897a9c0fc5378ad472ea88d361b6aac60bba6c
Kakanii/Mediiff_Assignment
/extract_errors_pb3.py
871
3.8125
4
import logging # Create and configure logger logging.basicConfig(filename="newfile.log", # format='%(asctime)s %(message)s', filemode='w') # Creating an object logger = logging.getLogger() # Setting the threshold of logger to DEBUG logger.setLevel(logging.DEBUG) ...
0383d8aad59e0824a361634321a26beab35eff5b
nishanthsolomon/leetcode
/arrays/introduction/max_consecutive_ones.py
467
3.546875
4
class Solution(object): def findMaxConsecutiveOnes(self, nums): count = 0 max_count = 0 for i in nums: if i == 1: count = count+1 if max_count < count: max_count = count else: count = 0 retur...
8826fcad370f72c4e43ec4bcbe767c19807f45cb
adamokasha/blackbox-python
/LaserController.py
11,673
3.609375
4
from Board import Board class LaserController: """LaserController class contains trajectory data member that indicates the laser's trajectory. Contains methods that scan the positions ahead of the laser's tip, change direction based on the atoms found by scanning ahead and performing traversal based on computed ...
689d43438ac91a22beb2765be7ffd5b3b258e580
quarter26/Python-100-Days
/Day01-15/myAnswer/day6/is_prime_alg1.py
426
3.921875
4
def is_prime(num): prime_list = [] prime_list.append(2) for i in range(3,num+1): is_prime = False for j in prime_list: if i % j == 0: is_prime = False break else: is_prime = True if is_prime == True: ...
2c6fb80d74f7c752c451cb1d28c91fa8767de50e
RuggeroPiazza/rock_paper_scissors
/rockPaperScissors.py
1,998
4.15625
4
import random """ This program execute a given number of runs of 'Rock, Paper, Scissors' game and returns stats about it. """ choices = ['paper', 'rock', 'scissors'] winning = [('paper', 'rock'), ('rock', 'scissors'), ('scissors', 'paper')] def run(): """INPUT: no input. OUTPUT: string. The functi...
ab080edea857693cdd9b09e3b67f7bc487faca26
jamdis/buffy-ml
/scrapers/tvguide.py
946
3.515625
4
import requests import re def getTvGuideSummaries(): ''' Get plot summaries from ihulu.com. Similar to itunes, everything is in a javascript object appended to the page. Unfortunately, we do need to load a page for each season ''' summaries = [] for season in range(1,8): r = requests.get('https://www.tvguide....
118ca8692cec4d69dd6e0049de3c715db46c9dd8
alyssaoc/python_examples
/tax.py
347
3.859375
4
for income in range(15000, 2000000, 500000): if income < 10000: tax_coefficient = 0.0 elif income < 30000: tax_coefficient = 0.2 elif income < 1000000: tax_coefficient = 0.35 else: tax_coefficient = 0.45 print('If I make', income,': I will pay', income * ...
5139236adfb6d2583d3af6ff57fa6575532fc5e2
d-0-r/Small-Games
/Ultimate-Guessing-Game/ultimate-guessing-game.py
3,110
4.125
4
#!/usr/bin/env python #-*- coding: utf-8 -*- import random import string import sys import time print "Welcome to the Ultimate Guessing game, please select one of the four game mode below." print "Enter 'q' at any time to quit the game." print "You'll have 3 tries to guess the randomly generated number, letter, or p...
230c56623901e0d4f60938207f23d67117f296c6
JamieMickaill/AcornMazeSolver
/cells.py
2,985
4.09375
4
""" Author SID: 500611960 Date: 20/05/2020 IT1110 Assessment Task - Acorn """ class Start: """ The starting cell of the board, can be walked over""" def __init__(self): self.display = 'X' self.message = None def __str__(self): return "Start" def step(self, game): return...
c6ac8e5e305f7e6b17a9b52a280a2615db196de5
seungdaegoh/practice_python
/p04-p11/p11_uniq.py
546
3.578125
4
#! /usr/bin/python3 #! /home/peter/anaconda3/bin/python3 import argparse import sys parser = argparse.ArgumentParser(prog='uniq.py', description='Filter adjacent matching lines from INPUT (or standard input)' ) args = parser.parse_args() in_method = sys.stdin ulist = []; for line in in_method: """ if ( "\n" n...
7a5fafc881c72913c1b1776e2f92294a4cef53ae
taohyson/newbie
/python/163/Python快速入门.tangyudi/3-Python字符串.py
791
3.984375
4
# coding: utf-8 # ### 字符串运算 # In[2]: 'hello' + ' world' # In[4]: 'hello ' *3 # ### 字符串函数 # In[25]: len('1 2 3 4 5') # In[23]: tang = '1 2 3 4 5' tang.split() # In[6]: tang_2 = ' ' tang_2.join(tang) # In[8]: tang = 'hello python' tang_3 = tang.replace('python', 'world') tang_3 # In[11]: tan...
db80171e4e9f64e0edd879c326f95af7bc309a08
taohyson/newbie
/python/runoob/Python循环嵌套.py
195
3.84375
4
#!D:\Python\Python27 #!D:\Python\Python36 # -*- coding: UTF-8 -*- num = 2 while num < 100: div = 2 while div <= (num/div): if 0 == num % div: break div += 1 else: print num num += 1
3c52c249b085f9f1c45ee5b973301bce7f9c93c5
taohyson/newbie
/python/runoob/Python运算符优先级.py
176
3.84375
4
#!D:\Python\Python27 #!D:\Python\Python36 # -*- coding: UTF-8 -*- a = 20 b = 30 c = 15 d = 5 e = 0 print ((a+b)*c/d) print (((a+b)*c)/d) print ((a+b)*(c/d)) print (a+(b*c)/d)
a31fa32eb26cde0df22817ff9f542062e5f6bb9a
varshachary/Data_Visualisation_Kaggle
/exercise1.py
3,614
4.15625
4
""" setup import pandas as pd pd.plotting.register_matplotlib_converters() import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns print("Setup Complete") Step 1: Load the data Your first assignment is to read the LA Museum Visitors data file into museum_data. Note that: The filepath to the dataset i...
86d915e578b24590ef63e47a03afcb79337c0796
silasgon/PythonLearnig
/patrica.py
806
4.0625
4
numero1 = input("Digite um numero: ") numero1 = int(numero1) numero2 = input("Digite um segundo numero: ") numero2 = int(numero2) if(numero1 == numero2): #operador de igualdade print("O numero %d é igual a %d. " %(numero1, numero2)) if(numero1 != numero2): #operador de diferença print("o numero %d é diferente...
27d54031124e488398bcd812da43850faae57bfe
minevadesislava/HackBulgaria-Programming101
/week2/4-Fractions/fraction.py
1,214
3.734375
4
from fractions import gcd class Fraction: def __init__(self, numerator, denominator): gd = gcd(numerator, denominator) self.numerator = int(numerator/gd) self.denominator = int(denominator/gd) def __str__(self): if self.denominator == 1: return str(self.numerator) ...
17170b524c8c873508d216741aec37bf1557a24d
minevadesislava/HackBulgaria-Programming101
/week3/1-Bank-Account/bank_account_test1.py
650
3.921875
4
import unittest from bank_account import BankAccount class BankAccountTest(unittest.TestCase): def test_create_new_account(self): account = BankAccount("Rado", 0, "$") self.assertTrue(isinstance(account, BankAccount)) def test_account_name_is_string(self): pass def test_create_int_v...
229f95c0fb4d42de7d80257c1a5dfc9f349c2d2b
minevadesislava/HackBulgaria-Programming101
/week5/graph.py
843
3.53125
4
class Graph: def _init_(self): self.graph = {} def has_node(self,node): return node in self.graph def add_edge(self,node_a, node_b): return node_a in self.graph[node_b] and node_b in self.graph[node_a] def get_neighbors_for(self,node): if self.has_node(node): ...
05d4b97aaabb14e87eeebfac239270e494c910c3
allanferreira/hangman_python
/hangman.py
1,098
4.09375
4
def main(): lifes = 6 win = None secret_word = "banana" display_letters = list("_" * len(secret_word)) print("* Welcome to The Hangman") while win is None: print("=======================") print(f"Lifes: {lifes}") print(" ".join(display_letters)) print("=========...
cca46af24502bb6a6be144745df6281ba42f757d
tl1759/FinalProject_PDS
/plots/plots_main.py
1,471
3.734375
4
# Name: plots_main.py # Author: Pan Ding # Date: May 08, 2015 # Summary: The main program, which does three things # 1) It loads the csv file into a dataframe and cleans the data. # 2) Then it asks the user to input a Borough name, and plots the volume of complaints for each agency in this Borough. It stops unti...
091445c3f5e8d4728c4f3529977139425806b2b2
sarahmgh7212/toy-robot
/main-script.py
3,751
4
4
canvas_x=5 canvas_y=5 x=0 y=0 directions=['WEST','SOUTH','EAST','NORTH'] direction='NORTH' menuNo=0 dirIndex=0 def report(): state = "Current state is: ({}, {}, {})" print('\n\n'+ state.format(x,y,direction)+ '\n\n') def showMenu(): print('\n\nThis is a 5*5 area,the robot is headed to north located at (0...
0cd51399d1c1d5e08cdc522da22e7b0ab4aaa4d2
manasmdg3/python
/F2CTemperature.py
601
4.28125
4
#Fahrenheit to Celcius Temperature def c2fConverter(): temp = float(input("\nEnter Temperature in Celcius: ")) print(str(temp)+" degree Celcius in Fahrenheit is: "+"{:.2f}".format((9*temp)/5+32)) def f2cConverter(): temp = float(input("\nEnter Temperature in Fahrenheit: ")) print(str(temp)+" degree Fahr...
5d0e99a9a6a1d612f7f76d0c630b0db8322a9222
DavidSouthgate/shlink-py
/shlink/data/error.py
570
3.515625
4
from typing import Dict from ..data import Data class Error(Data): code: str message: str def __init__(self, code: str, message: str): self.code = code self.message = message def to_dict(self) -> Dict: return { "code": self.code, "message": self.messag...
9aff11cc554d9567141f292091d60eea7e47473c
renegadevi/hour-calculator
/main.py
2,678
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Hour Calculator Quickly made hour calculator for 24h day clock to prevent the need of relying on a website for simple time calculations. Does the work; enter timestamps, shows results in a table of elapsed time and total hours. """ import datetime import sys import ...
3f69b3adf92ed260c7eb07b5c8528cfebc6799f3
Mahdieh-Aghagoli/PythonPrograms
/phonebook.py
1,823
3.96875
4
def person_information(): # Receiving and storing personal information while True: personal_information = {} print("Enter new user information:") personal_information["name"] = input("Name: ") personal_information["surname"] = input("Surname: ") personal_information["cell...
dadb2bae5b6cc583dc508c41c2170808934ac213
J-Farmer/AdvancedPythonTraining
/Basics/basics_06.py
362
3.65625
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 14 12:40:14 2020 @author: jfarm """ name = "Jake" favoriteFood = "Spaghetti" strConcat = name + "'s favorite food is " + favoriteFood + "!" print(strConcat) strFormat = "{}\'s favorite food is {}!".format(name,favoriteFood) print(strFormat) strFstr = f"{name}'s favori...
f9cd4e83235bbf6c194023052a82cf6a8fc09c6d
J-Farmer/AdvancedPythonTraining
/Basics/basics_05.py
481
3.546875
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 14 11:10:05 2020 @author: jfarm """ string1 = 'hello' print(string1) print(string1[1]) #string1[1] = 'E' # Strings are immutable. This causes an error. string2 = string1[0] + 'E' + string1[2] + string1[3] + string1[4] print(string2) print(string1.upper()) print(string2.l...
0b8a4804eb4c2d1ead0c5951153001ab8afdb8a5
suep1984/suvorov_evgenii_dz
/suvorov_evgenii_dz_1/task_3_1.py
355
3.828125
4
for item in range(1, 101): if item % 10 == 1 and (item // 10 == 0 or item // 10 >= 2): print(f'{item} процент') elif 2 <= item % 10 <= 4 and (item // 10 == 0 or item // 10 >= 2): print(f'{item} процента') elif item // 10 == 1 or item % 10 == 0 or 5 <= item % 10 <= 9: print(f'{item} п...
f1a6651539574f772809b0937983da612597beeb
jdt-w/python_course
/Task 17/welpodron/welpodron.py
318
3.71875
4
spisok_1 = [[28, 70, 36], ['Строка 1', "Строка 2"]] number_1 = 13 number_2 = number_1 + 5 stroka_1 = 'Строчка' for spisok in spisok_1: for element in spisok: print(element) number_3 = 0 while number_3 < 2: for element in spisok_1[number_3]: print(element) number_3+=1
c84cb5f1751a5626733cb76a8ed56d2a2aa9a096
ziping0509X/Replacespace
/Replacespace.py
531
3.71875
4
#剑指第2题 #请实现一个函数,将一个字符串中的每个空格替换成“%20”。 #例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 def Replacespace(char,lenth): char=list(char) for i in range(lenth): if char[i] == " ": char[i]="%20" char=[str(i) for i in char] char=''.join(char) return str(char) sentence=input() sent...
65811fb8e46e5c7cdd89de58c9c82b634517c2b5
johnnyjosephpro/pythonProject
/Tirage.py
309
3.765625
4
import random nombre_aleatoire = random.randint(1, 1000) print(nombre_aleatoire) premier_essai = input("Entrer un nombre aleatoire:") resultat = premier_essai == nombre_aleatoire if (resultat==False): premier_essai = input("Entrer un nombre aleatoire a nouveau:") else : print("Vous avez gagner!")
360e615a56f6911dc312ce0e4a3903e804dfed3a
GILLA-SAITEJA/Innomatics_Internship
/Day_4/Day_4 String Validators.py
233
3.515625
4
if __name__ == '__main__': s = input() for i in ('isalnum', 'isalpha', 'isdigit', 'islower', 'isupper'): if any(eval("a." + i + "()") for a in s): print(True) else: print(False)
56cc0fb6eaa4cd0cdc2e526e01817fa5d07c1637
UKoksal/C-Compiler-and-Translator
/tmp/formative/f9-got.py
294
3.796875
4
def function(a,b): if (a < b): a = a - 1 if (b < a): b = b + 3 if (a == b): return (a * b) return b return 13 def main(): return function(0,0) + function(1,2) + function(4,3) + function(6,7) # Boilerplate if __name__ == "__main__": import sys ret=main() sys.exit(ret)
4a3a621076990ef0ae8b18fc2013b87ddafa0732
PdxCodeGuild/Programming102
/resources/example_lessons/unit_1/101_review_template.py
10,230
4.1875
4
""" Programming 102 101 Review """ """ Units 1 & 2 - variables, strings & string operations, f-strings, input(), int/float """ # = is the assignment operator. Assigns the value on the right to the variable on the left. # define a variable 'animal' and assign the string 'dog' to it using = # -------------------------...
19417f1341586b312eea962a98a99d8453109117
PdxCodeGuild/Programming102
/resources/example_lessons/unit_4/examples/vending_machine_simple/vending_machine.py
958
4.09375
4
from utilities import inventory, display_menu, get_total, item_in_inventory def main(): while True: # display the inventory in a nice way display_menu() item = input('Enter the name of the item you want: ') # ask again if the item isn't in the inventory ...
c0da82154044bc19c0417101c83f80c25c3b160e
PdxCodeGuild/Programming102
/resources/example_lessons/unit_2/grading_with_functions.py
1,633
4.25
4
import random # for randint() #### add this function if there's time """# return True if the number is between 1 and 100 # return False otherwise def get_modifier(score): ''' return a grade modifier based on a score ''' # isolate the ones digit of the score with % 10 ones = score % 10 modifier...
18ac4d3b8eb8c483b33d2642eef6abc216a6eda2
bilginyuksel/AlgorithmSolutions
/hackerrank/the-great-xor.py
273
3.734375
4
def greatXor(num): power = 0 result = 0 while num != 0: if num & 1 == 0: result += 2 ** power power += 1 num >>= 1 return result test = int(input()) for _ in range(test): num = int(input()) print(greatXor(num))
d714a8ea04633d3a42c0b629f9e4df947159c175
bilginyuksel/AlgorithmSolutions
/leetcode/mergeKSortedLists.py
2,736
3.84375
4
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class QueueNode: def __init__(self, listIdx, listNode): self.listNode = listNode self.listIdx = listIdx self.val = self.listNode.val class MinHeap: def __init__(self): ...
f11523a76a0bfeab5d908107a4c4ca029a91e918
adityachanekar/ML_Internship_2018
/ML Internship/Python/tuple dictionaries.py
373
3.828125
4
''' def function_name(msg,name='jev'): """This is a function to print""" print("Hello" + name + msg) #print(function_name.__doc__) function_name(name='Hello Friends',msg='Chai') function_name('Jyesh') #values to normal argument and then pass values to default ''' a=10 def add(c,b): global a print(a)...
b1141f910e6d5f89a4ad9f1d680f1cec00c93937
vanyjc/Vania_Espejel_1560
/Lluvias3D/Array3D.py
1,251
3.640625
4
class Array3D: def __init__( self , rows , cols , depth): self.__rows = rows self.__cols = cols self.__depth = depth self.__data = [] for d in range(self.__depth): #2 aux = [] for r in range(self.__rows): #3 aux2 = [] ...
d75ae92d25c7f0e1e09a9a52f45181d0443fbba0
vanyjc/Vania_Espejel_1560
/TareaSumaListaRecursiva.py
268
3.546875
4
def suma_lista(lista): if len(lista)==1: return lista[0] else: value = lista[len(lista)-1] lista.pop(len(lista)-1) return value + suma_lista(lista) def main(): l = [3,5,2,4] print(suma_lista(l)) main()
dc7394d09ca720594559424567ea18bc34c403f7
yashika0810/caarpil2020
/decision.py
1,707
4
4
'''x=int(input("Enter any integer")) if x<0: if x>-5: print("result is greater than -5") else: print("result is less than -5") elif x==0: print("result is 0") elif x>0 and x<30: print("result is positive and in the range 30") else: print("result is greater than 30") while True: ...
00e9d9188ee0a8fb0e5e22cebe24ff52141a0ef2
aitc-h/euler
/src/problem17.py
1,855
3.65625
4
""" Problem 17 Number letter counts """ from utility.decorators import timeit, printit words = { 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen", 14:...
888adf4cd27a9bc91486cafbd621f21c7662d4d0
aitc-h/euler
/src/problem15.py
935
3.8125
4
""" Problem 15 Lattice Paths My first attempt at this problem involved iterating over all possible binary numbers between 0 and 2^(2n), which as you can probably guess got big fast. I dread to think of the time complexity. Then I took a mathematical look at the sequence trying to find some sort of pattern, an...
c60bcbfeefec0c34ef0a88f25a1e071aa8ca555d
hannahaih/quantum-gan-image-generation
/src/discriminator.py
842
3.65625
4
import tensorflow as tf def discriminator_network(num_nodes_1, num_nodes_2, alpha_1=0.01, alpha_2=0.01): """ Constructs a three-layer classical discriminator in a sequential model using keras Args: num_nodes_1 (int): # of nodes in the first layer num_nodes_2 (int): # of nodes in the second ...
2bb6c3ed1f270d94d3cc66bd1babb1566e34dc60
tassiahmed/sentencecraft
/SentenceCraftApp/LexemeCollection.py
3,072
3.671875
4
''' LexemeCollection module. This provides an abstract base class utilizing the Template design pattern for collections of different lexemes to inherit from. ''' # abstract base class module import abc class LexemeCollection(object): ''' Abstract represention a collection of lexemes. A collection of sen...
763d77850e19543c47e51e4b9c70fec2fd3a22f3
Amit-Git1690/APICode
/Practice/Demo/Pattern_1.py
157
4
4
''' Created on 20-Oct-2019 @author: Amitava ''' n=5 for i in range(1,n+1): print(i, end=" ") print() for i in range(1,n+1): print(i, end=" ")
05918566fe279c92c0632c57ae8c5d81e2a4239f
Amit-Git1690/APICode
/Practice/String/NumberPattern.py
136
3.609375
4
''' Created on 17-Nov-2019 @author: Amitava ''' for i in range(0,5): for j in range(i+1): print(j , end=" ") print()
0fb9823e4724afbace1b7b392876fc3d6661f933
pramodchahar/Python_A_2_Z
/lists/slices.py
540
4.5625
5
########################### # Slicing of List ########################### # makes new lists using slices or parts of original lists # list_name[start:end:step] #sort of similar to range(start,end,step size) num_list=[11,22,33,44,55,66,77,88,99] print(num_list[3:]) print(num_list[5:]) print(num_list[-1:]) pri...
2801f36ae298e18816768e6948b7fe57274fc913
pramodchahar/Python_A_2_Z
/simple_apps/unlucky_number.py
172
3.671875
4
for i in range (1,21): if i ==4 or i ==13: state='Unlucky' elif i %2 ==1: state='Odd' else : state='Even' print(f'{i} is {state}')
2eb5d6e96aa9cc6b08b66e5724bb3b2bb7fc9960
Javenkm/Functions-Basic-2
/functions_basic2.py
2,376
4.28125
4
# 1. Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one, from the number (as the 0th element) down to 0 (as the last element). # Example: cuntdown(5) should return [5, 4, 3, 2, 1]. def countDown(num): list = [] for x in range(num, -1, -1): list.app...
86840d5e0800786220b821590a9dcb8066d2091b
AMIRANDA9112/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/6-print_comb3.py
259
3.78125
4
#!/usr/bin/python3 for n in range(0, 10): for i in range((n + 1), 10): if i != n: print("{:d}{:d}".format(n, i), end="") if n == 8 and i == 9: print("") break print(", ", end="")
570facd126414fe6895411554eeaf3696cefb65d
AMIRANDA9112/holbertonschool-higher_level_programming
/0x0B-python-input_output/14-pascal_triangle.py
470
3.875
4
#!/usr/bin/python3 """this module create a list with the triangle pascal sequence""" def pascal_triangle(n): """ :param n: limit of triangle :return: list with the pascal triangle sequence """ triangle = [] row = [] prev_row = [] for i in range(0, n + 1): row = [j > 0 and j < ...
0f8139a28a0631b3cd70a8ba735fd030c13e73e5
AMIRANDA9112/holbertonschool-higher_level_programming
/0x0A-python-inheritance/100-my_int.py
296
4
4
#!/usr/bin/python3 """This module creates a Class""" class MyInt(int): """ Int class """ def __init__(self, number): self.number = number def __eq__(self, other): return self.number != other def __ne__(self, other): return other == self.number
356b0801e19301fc052981ea27555cedad3237ec
Rock-Tsui/algorithm
/DPA-maxSum.py
879
3.546875
4
#!/usr/bin/env python # coding=utf-8 ''' 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 在上面的数字三角形中寻找一条从顶部到底边的路径, 使得路径上所经过的数字之和最大。路径上的每一步都只 能往左下或右下走。只需要求出这个最大和即可,不必给 出具体路径。三角形的行数大于1小于等于100,数字为0-99''' import random MAX = 10 subSet = [[-1] * MAX for _ in range(MAX)] def getMaxSum(n): global subSet maxSum = subSet[n] ...
2c36211694903e77e7f8f3c4a72759c9e9c8b782
Danielnadav/WorldOfGames
/MemGame.py
1,077
3.609375
4
import random import time def generate_sequence(): try: print("Welcome to our Memory Game, Please try remmber the bumbers ;") mc_list=[] mc_list.append(random.sample(range(1, 101), 5)) print(str(mc_list)) time.sleep(4) print("\n" * 100) except: print("Er...
ae6a75f90f8ddb39fd2f8a2f0c0f4020f9390a0a
shawn3298317/leetcode
/209_implement_trie/test.py
1,852
4.0625
4
class Node(object): def __init__(self, val, child=None): # need parent pointer? self.val = val self.child = child if child else {} class Trie(object): def __init__(self): """ Initialize your data structure here. """ self.root = Node(None) # a dummy node ...