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
b33e6d93be650bfcfe25852ffd17b411915c7d4f
ghmkt/3th_EDU
/Session03_Python_element_3/Session03_Quest_answer_3.py
1,838
3.609375
4
# 클래스 연습문제 class stock_analysis: def __init__(self, code): try: with open("c:\\Users\\LYJ\\Desktop\\파이썬세션데이터\\{0}.csv".format(code)) as f: self.lines = f.readlines() except FileNotFoundError: print("{0} 파일을 로드하는데 실패했습니다".format(code)) else: self.le...
5c9da03dc72008401f422d092f27b27bedd28177
AspenH/K-Nearest-Neighbor-Algorithm
/knn.py
3,625
3.78125
4
# Programmed by Aspen Henry # This program uses two .csv files within its directory (trainging data and test sample data) # to classify test samples using the K Nearest Neighbor algorithm. import math #This function is used to preformat the csv files for use #It assumes that the csv is in the form [class_label, a1, a2...
df3157fb21a7d9d35fdd8ce4550733a859f3a64c
Potrik98/plab2
/proj5/fsm/utils.py
166
3.625
4
# # Check if a string is an integer # def is_int(string: str) -> bool: try: int(string) return True except ValueError: return False
c259e8f8f0be2ae221e13062855d370df14d9691
Potrik98/plab2
/proj3/crypto/AffineCipher.py
1,281
3.5
4
from crypto.SimpleCipher import SimpleCipher from crypto.Cipher import Cipher, alphabet, alphabet_length from crypto.MultiplicationCipher import MultiplicationCipher from crypto.CaesarCipher import CaesarCipher class AffineCipher(SimpleCipher): class Key(Cipher.Key): def __init__(self, ...
ec44a59c2bfda5f812b86363dd4ad98c114361a1
yashmalik23/python-domain-hackerrank
/the minion game.py
339
3.515625
4
def minion_game(s): vowels = 'AEIOU' kev = 0 stu = 0 for i in range(len(s)): if s[i] in vowels: kev += (len(s)-i) else: stu += (len(s)-i) if kev > stu: print ("Kevin", kev) elif kev < stu: print ("Stuart", stu) else: ...
7ebd2319068650b767db0961f553832b4af556b1
PythonHacker199/Bargraph-3d-
/main.py
541
4.09375
4
# Hi gus #welcome to hacker python channel # today we will learn how to make bar graph #we need to install matplotlib package from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig=plt.figure() ax1=fig.add_subplot(111,projection='3d') xpos=[1,2,3,4,5,6,7,8,9,10] ypos=[1,2,3,4...
2b908cba6c3ff6eea86011228e03224a22bec643
Kenneth-Fries/Kenneth_Fries
/Pairs 2-25-19 best path.py
5,195
4.25
4
"""The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess. The knight has an in...
27fd01141cf75a31a087b5fa5b47e7b203b0bdbd
FuelRats/pipsqueak3
/src/packages/utils/autocorrect.py
1,450
3.578125
4
""" autocorrect.py - Methodology to attempt auto-correcting a typo'd system name. Copyright (c) 2019 The Fuel Rat Mischief, All rights reserved. Licensed under the BSD 3-Clause License. See LICENSE.md This module is built on top of the Pydle system. """ import re def correct_system_name(system: str) -> str: ...
7c967ec0e9a7286ab5569133662f8966efcfd80b
coder-kiran/pythonCalculator
/pythonCalculatorByKK.py
10,311
3.625
4
# Python Calculator by Kiran K K from tkinter import * from tkinter.messagebox import * import math window = Tk() window.geometry("230x350") window.title("I Calculate") window.configure(bg='#000066') window.resizable(0,0) s0 = s1 = s2 = "" famous="" equalClickedOn = False font=('verdana',10) #------------------ funct...
331ea7efc532c4d9f09da6b6497be679c91de9ff
layanabushaweesh/math-series
/tests/serises_test.py
1,828
3.65625
4
# testing fibonacci function :) from math_serises.serise import fibonacci def test_fib_0(): expected=0 actual=fibonacci(0) assert actual == expected def test_fib_1(): expected=1 actual=fibonacci(1) assert actual == expected def test_fib_2(): expected=1 actual=fibonacci(2) assert actual == expected def test...
b6a2e295b45e45114c947f339cfae96b8faa8229
rompe/adventofcode2020
/src/day02.py
503
3.71875
4
#!/usr/bin/env python import itertools import sys def solution(input_file): """Solve today's riddle.""" lines = open(input_file).read().splitlines() valids = 0 for line in lines: count, char, password = line.split() char = char[0] lowest, highest = count.split('-') if ...
d0bca1738a9a21e3888084c65786e73bff22fe7d
CodecoolBP20161/python-pair-programming-exercises-4th-tw-miki_gyuri
/3-phone-numbers/main.py
1,266
3.796875
4
import csv import sys from person import Person def open_csv(file_name): with open(file_name, 'r') as phone_number: names_n_numbers = [line.split(",") for line in names_n_numbers.readlines()] numbers = [] numbers = numbers.digits for element in names_n_numbers: for i in...
f62b64433ab03f57cc107b63c7c853590be44a9f
koiku/nickname-generator
/main.py
1,028
3.640625
4
""" * 0 - Vowel letter * * 1 - Consonant letter """ import random VOWELS = ['a', 'e', 'i', 'o', 'u', 'y'] CONSONANTS = [ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' ] MIN_LEN = 3 MAX_LEN = 8 def main(): length = random.randint(MIN_LEN, MAX_LEN) nickname...
d924bcfa89f8453db0f96e452469e2bbd15c21d3
ScottRWilson11/WebScrapingHW
/webscraping.py
889
3.546875
4
import pandas as pd from bs4 import BeautifulSoup import requests url1="https://www.nasa.gov/feature/jpl/nasas-next-mars-mission-to-investigate-interior-of-red-planet" r = requests.get(url1) data = r.text soup = BeautifulSoup(data, features="html.parser") news_title = soup.title.text print(news_title) ta...
64b86298ac0017b88bf25e6d658a6bc9b4c22d0a
panwuying/homework5
/work6.py
203
3.53125
4
a="4 4 213 123 124 1 123 " a=a.split() a=[int(x) for x in a] def all_list(b): c = min(b) for i in range(len(b)): if c==b[i]: print(i) break all_list(a)
96aa4c549c9a5341a565699832cdbbf30ff406e7
liweinan/hands_on_ml
/sort_class.py
982
4.125
4
from collections import OrderedDict class Student: def __init__(self, name, order): self.name = name self.order = order tom = Student("Tom", 0) jack = Student("Jack", 0) rose = Student("Rose", 1) lucy = Student("Lucy", 2) users = OrderedDict() users[rose.name] = rose users[lucy.name] = lucy user...
6c112be7a3443ebd31b68bfe73f424af50ca34af
abhishekshrestha008/Binary-and-Linear-Search-Algorithms
/searchMain.py
1,242
3.84375
4
import random from search import linear_search, binary_search from time import time import matplotlib.pyplot as plt elapsed_linear = [] elapsed_binary = [] x = [] for i in range(10000, 100000, 10000): #Data data = random.sample(range(i), i) sorted_data = sorted(data) random_number = random.randint(0,len(da...
ebb33953daccc725fab8383a652c8fd60c181ff1
ferdirn/hello-python
/python_min.py
185
3.65625
4
#!/usr/bin/env python list1, list2 = ['xyz', 'abc', 'opq'], [8, 9, 3, 5, 6] print 'list1', list1 print 'list2', list2 print 'min(list1)', min(list1) print 'min(list2)', min(list2)
be66511c268ce38ea8d4e3ce561894c390bccbc2
ferdirn/hello-python
/hari.py
349
3.84375
4
#!/usr/bin/env python nama_hari = raw_input('Masukkan nama hari : ') if nama_hari == 'sabtu' or nama_hari == 'minggu': print 'Weekends' elif nama_hari == 'senin' or nama_hari == 'selasa' or nama_hari == 'rabu' or nama_hari == 'kamis': print 'Weekdays' elif nama_hari == "jum'at": print 'TGIF' else: pri...
7937dba17b2af72fcedc087ce51375b73258e3e0
ferdirn/hello-python
/yourname.py
195
3.875
4
#!/usr/bin/env python firstname = raw_input('Your first name is ').strip() lastname = raw_input('Your last name is ').strip() print "Hello {} {}! Nice to see you...".format(firstname, lastname)
4de4ba9a0b6507c01147f52527413bfbf0305982
ferdirn/hello-python
/ternaryoperator.py
231
4.1875
4
#!/usr/bin/env python a = 1 b = 2 print 'a = ', a print 'b = ', b print '\n' #ternary operator print 'Ternary operator #1' print 'a > b' if (a > b) else 'b > a' print '\nTernary operator #2' print (a > b) and 'a > b' or 'b > a'
fc7b4eb2b4ffe1f9021b3cf27842600cdc88e098
ferdirn/hello-python
/bitwiseoperators.py
337
3.796875
4
#!/usr/bin/env python print 'binary of 5 is', bin(5)[2:] print 'binary of 12 is', bin(12)[2:] print '5 and 12 is', bin(5&12)[2:] print '5 or 12 is', bin(5|12)[2:] print '5 xor 12 is', bin(5^12)[2:] print 'not 5 is', bin(~5) print '2 shift left 5 is', bin(5<<2)[2:], ' or ', 5<<2 print '2 shift right 5 is', bin(5>>2)[2...
986e29934e3ad5528978247f8eaf1be4173e10e3
ferdirn/hello-python
/comparison_operators.py
411
3.546875
4
#!/usr/bin/env python print 'is equal' print '10 == 20 ' + str(10 == 20) print '\nis not equal' print '10 != 20 ' + str(10 != 20) print '10 <> 20 ' + str(10 <> 20) print '\ngreater than' print '10 > 20 ' + str(10 > 20) print '\nless than' print '10 < 20 ' + str(10 < 20) print '\ngreater than or equal to' print '10...
683501e8b36347e0fc89b461d33ca8ade2457895
ferdirn/hello-python
/kelvintofahrenheit.py
294
3.796875
4
#!/usr/bin/env python def KelvinToFahrenheit(temperature): assert (temperature >= 0), "Colder than absolute zero!" return ((temperature-273)*1.8)+32 try: print KelvinToFahrenheit(273) print KelvinToFahrenheit(-5) except AssertionError, e: print e.args print str(e)
4da324086fd2415baf3a247e24841560fc29a8b1
sharpvik/python-libs
/search.py
2,353
3.640625
4
# # ================================== BBBBBB YY YYY MMMM MMMM RRRRRR VV VVV RRRRRR # = THE = BBB BB YY YYY MMMMM MMMMM RRR RR VV VVV RRR RR # ===> Search functions library <=== B...
fb89441290c0ebb8992bbe6ac22ef88da84b0afd
sharpvik/python-libs
/graphD.py
5,155
3.734375
4
# # =============================== BBBBBB YY YYY MMMM MMMM RRRRRR VV VVV RRRRRR # = THE = BBB BB YY YYY MMMMM MMMMM RRR RR VV VVV RRR RR # ===> Graph class <=== BBBBBB ...
55075c4e6d4561690da93b466a2f1a7c2319be64
MMahoney6713/cs50
/pset6-Python/credit.py
243
3.640625
4
card = input('Card Number? ') var = 0 for i in range(1, length(card), 2): value = int(card(i)) * 2 if value > 9: value = str(value) value = int(value[1]) + int(value([2]) var += value print(f"{round_1_sum}")
4b089ecb061076b81df93e125f0b86f259b3197d
bognan/training_python
/guess the random namber/random number from computer.py
1,121
3.703125
4
import random number = random.randint(1, 100) users_count = int(input('Введите количество игроков: ')) users_list = [] for i in range(users_count): user_name = (input(f'Введите имя игрока {i}: ')) users_list.append(user_name) count = 1 levels = {1: 10, 2: 5, 3: 3} level = int(input('Выбирете уровень сложнос...
2bc2bbc4f60dddbef026efbc41a63ab24182cd25
bognan/training_python
/HW/HW№2.py
234
4.03125
4
number = int(input('Введите любое число: ',)) while (number > 10) or (number < 0): number = int(input('Побробуйте еще: ',)) else: if number <= 10: print('Результат:', number ** 2)
4415824dde9566902bf6a7bb9015764785597c02
mateusPreste/Testing
/Testing/Plot.py
202
3.65625
4
from matplotlib.pyplot import * import numpy as np def f(t): return t**2*np.exp(-t**2) t = np.linspace(0, 3, 310) y = np.zeros(len(t)) for i in range(len(t)): y[i] = f(t[i]) plot(t, y) show()
6b94e8638f16b58df5460af29cb8f13e2a8e53bc
mittalpranjal12/Basic-Python-Codes
/swap_two_numbers.py
312
4.09375
4
#swap two numbers x = int(input("Enter first number: x= ")) y = int(input("Enter second number: y= ")) print("Value of x and y before swapping is {0} and {1}" .format(x,y)) #swapping using temp temp = x x = y y = temp print("\nThe value of x and y after swapping is {0} and {1}" .format(x ,y))
9392258cba43a64ce272d77ab90b889c020946d9
LorenBristow/module3
/ch04_UnitTesting/is_prime.py
1,237
3.875
4
# -*- coding: utf-8 -*- """ Created on Mon Jan 28 10:00:27 2019 @author: loren """ #### TASK 1 - PRIME NUMBERS to FAIL & TASK 2 - to PASS #### def is_prime(number): '''Return True if number is a prime number''' if number <= 1: return False elif number > 1:#to prevent div by 0 error for ea...
771b2e1c61a2466875e9b9ed32ba91d9c7625e01
ChChLance/sc_project
/stancode_project/boggle_game_solver/boggle.py
3,669
3.90625
4
""" File: boggle.py Name: ---------------------------------------- TODO: """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it FILE = 'dictionary.txt' word_lst = [] bog_lst = [] ans_lst = [] legal_edge = [] record_lst = [] look_up_dict = {} def main(): ...
0d6582833054a0596747ea349f9d714deeb5b355
fxyan/data-structure
/code/反转链表.py
214
3.859375
4
def reverseList(head): """ :type head: ListNode :rtype: ListNode """ q = None while head is not None: p = head head = head.next p.next = q q = p return q
9185b85e3286d25f7e59612585b183302cb81b47
fxyan/data-structure
/queue.py
813
4.0625
4
class Node(object): def __init__(self, element=None, next=None): self.element = element self.next = next def __repr__(self): return str(self.element) class Queue(object): def __init__(self): self.head = Node() self.tail = self.head def empty(self): ret...
e86aed6b3987db89dd58700410da0a25a030f5f7
fxyan/data-structure
/code/剑指/删除链表中重复的节点.py
1,226
3.96875
4
""" 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留。 样例1 输入:1->2->3->3->4->4->5 输出:1->2->5 样例2 输入:1->1->1->2->3 输出:2->3 这个题是比较绕的,思路有些清奇 首先先设定一个虚拟节点 None 将他的next连到头结点上去 p永远是前一个节点 q是p的下一个节点 while 如果让q等于p.next 直到q的值为一个新的节点的值 然后拿 p的第二个节点对比如果相等那么p直接下移 如果不等那么将p的next指向q """ # Definition for singly-linked lis...
99bad259f692251137282ccf7b168ba6a67d1ac0
fxyan/data-structure
/code/lookup_array.py
654
3.6875
4
""" 二维数组查找数据 首先确定行数和列数 将左下角第一个数设为n 如果这个整数比n大,那么就排除这一行 向上查询 如果这个整数比n小,那么就排除这一列像右查询 """ class Solution: # array 二维列表 def Find(self, target, array): # write code here rows = len(array) - 1 cols = len(array[0]) - 1 i = rows j = 0 while j <= cols and i >= 0: ...
97b3f526a267e916bb6ae64e4a1db6b5d5bb372d
fxyan/data-structure
/code/剑指/机器人移动范围.py
1,394
3.578125
4
""" 地上有一个 m 行和 n 列的方格,横纵坐标范围分别是 0∼m−1 和 0∼n−1。 一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格。 但是不能进入行坐标和列坐标的数位之和大于 k 的格子。 请问该机器人能够达到多少个格子? 样例1 输入:k=7, m=4, n=5 输出:20 样例2 输入:k=18, m=40, n=40 输出:1484 解释:当k为18时,机器人能够进入方格(35,37),因为3+5+3+7 = 18。 但是,它不能进入方格(35,38),因为3+5+3+8 = 19。 这里还是用了深搜 """ class Solution(object): ...
d926c569be01e185ea52383e988360694ec1809c
fxyan/data-structure
/Array.py
602
3.96875
4
# 定长的列表 class Array(object): def __init__(self, size=8): self._size = size self._item = [None] * size def __len__(self): return self._size def __getitem__(self, index): return self._item[index] def __setitem__(self, key, value): self._item[key] = value def...
348fd28791be8033b293c27087b6861ec35b6989
fxyan/data-structure
/exercise.py
12,479
4.0625
4
""" 冒泡排序 首先从第一个数循环到倒数第二个数 n-1 最后一个数已经被安排了 内层循环开始从第一个数开始循环 n-1-i次,因为i也被安排了 边界检测如果为没有数 def bubble_sort(array): if array is None or len(array) < 2: return array for i in range(len(array)-1): for j in range(len(array)-i-1): if array[j] > array[j+1]: array[...
8880877537ac0e945bde820806c56cb008125b9f
leox64/ADT
/Array.py
1,087
3.78125
4
#array class Array: def __init__(self,n): self.data=[] for i in range(n): self.__data.append(None) def get_length(self): return len(self.__data) def set_item(self,index,value): if index >= 0 and index < len(self.__data): self.__data[index...
ffc2780064c17ff9d45e2b817fbd0c4208c330a9
Anthonywilde1/pythonpractice
/practice.py
814
3.828125
4
# Fibonacci series: # the sum of two elements defines the next a, b = 0, 1 while a < 1000: print(a) a, b = b, a+b letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] name = letters[0] + letters[13] + letters[19] + letters...
91764a0218ca3632eac11064e1312c30e1ead470
SrCarlangas1/Practica7
/Exercici_06.py
233
3.828125
4
print "Dime un nombre" prime=raw_input() pepe=list(prime) print pepe print "Dime un caracter" susti=raw_input() if susti in pepe: print "El caracter esta en tu nombre" else: print "El caracter no esta en tu nombre"
c3bc1f9db4fd2ab9b4ba40ce7e8d69b0da87fd42
lior20-meet/meet2018y1lab2
/MEETinTurtle.py
972
4.15625
4
import turtle turtle.penup() #Pick up the pen so it doesn’t #draw turtle.goto(-200,-100) #Move the turtle to the #position (-200, -100) #on the screen turtle.pendown() #Put the pen down to start #drawing #Draw the M: turtle.goto(-200,-100+200) turtle.goto(-200+50,-100) turtle.go...
7235257c51e5a1af67454306e76c5e58ffd2a31c
VeronikaA/user-signup
/crypto/helpers.py
1,345
4.28125
4
import string # helper function 1, returns numerical key of letter input by user def alphabet_position(letter): """ Creates key by receiving a letter and returning the 0-based numerical position of that letter in the alphabet, regardless of case.""" alphabet = string.ascii_lowercase + string.ascii_uppercase ...
ed3c20641bdad8b23f85153994fef6345af81de5
echibe/Projects
/Python/Scrape.py
660
3.796875
4
#Elliot Chibe #September 15th, 2016 #Given a YouTube video link this will output the title, description, and user of the video #Uses BeautifulSoup and requests for Python import requests from bs4 import BeautifulSoup url = raw_input("What is the URL: ") r = requests.get(url) soup = BeautifulSoup(r.content, "lxml") ...
a87fe2d7477098d5cb41c018fccc47b787b1ff8d
rlazarev/powerunit
/powerunit.py
1,048
3.65625
4
#!/usr/bin/env python # Import the modules to send commands to the system and access GPIO pins. from subprocess import call import RPi.GPIO as GPIO from time import sleep # Map PinEleven and PinThirteen on the Power.unit PCB to chosen pins on the Raspberry Pi header. # The PCB numbering is a legacy with the original ...
3f4b48b07ce6785b6a30ab7651d62ab2b730adc3
MBScott1997-zz/Python_Projects
/Scott_MarvelMart.py
7,535
3.640625
4
''' Python Project - Marvel Mart Project Michael Scott Due: March 10, 2020 ''' import csv import numpy as np import pandas as pd import collections from collections import defaultdict pd.set_option('display.float_format', lambda x: '%.3f' % x) #Part 1: Cleaning the data #Cleaning ints out of Country ...
237cbd779d44ac9cdc04edd467647769c4781c97
andxu282/poker_engine
/models/rank.py
510
3.546875
4
""" The rank of the card (2 through Ace). The rank is represented by a single character string (the number itself for 2-9 and T, J, Q, K, A for 10, Jack, Queen, King, and Ace respectively. """ from helpers.constants import rank_dict class Rank(): def __init__(self, rank_str): self.rank_str = rank_str ...
22f0b036d436b9d8b3021b349c612f7322720db3
sayalijo/my_prog_solution
/hacker_rank/Algorithms/Warmup/min_max_sum/min_max_sum.py
243
3.796875
4
#!/bin/python3 import sys def miniMaxSum(arr): # Complete this function x = sum(arr) print (x-(max(arr)), (x-(min(arr)))) if __name__ == "__main__": arr = list(map(int, input().strip().split(' '))) miniMaxSum(arr)
ff2c1fc5723a4c3309b97226e849bd0c7f824210
sayalijo/my_prog_solution
/geeks_for_geeks/Algorithms/Searching/binary_search/binary_search.py
566
4.0625
4
def binary_search(arr, x, start_index, end_index): if end_index >= 1: mid_index = start_index + (end_index - start_index)//2 if arr[mid_index] == x: return mid_index elif arr[mid_index] > x: return binary_search(arr, x,start_index, mid_index - 1) else: return binary_search(arr, x, mid_index+1, end_i...
c4d7076b3ef58086aa5b0d53c3168d5292e57836
sayalijo/my_prog_solution
/geeks_for_geeks/Arrays/arrangements/move_all_zeros_end/move_all_zeros_end.py
368
3.78125
4
# arr[] = {1, 2, 0, 0, 0, 3, 6} # Output : 1 2 3 6 0 0 0 def rearrange(ar): i,j = -1, 0 for j in range(len(ar)): if ar[j] > 0: i += 1 ar[i], ar[j] = ar[j], ar[i] return ar array = list(map(int, input("Enter your array:\t").split(" "))) result = rearrange(array) print("Now...
b5fe57756695c05b2f96eb62de309d88a45fb40f
sayalijo/my_prog_solution
/hacker_rank/Algorithms/Implementation/manasa_and_stones/manasa_and_stones.py
753
3.515625
4
#!/bin/python3 import sys def stones(n, a, b): a,b = min(a,b), max(a,b) diff = b - a stones = n - 1 current_stone = a * stones max_stone = b * stones #result = [] if a == b: #result.append(current_stone) yield current_stone return result else: while ...
4db6f63da2c03590a2765d346707db7667d82d36
jaykumarvaghela/python-for-fun
/printfunction.py
138
3.640625
4
n = int(input()) list = [] i = 1 while (i <= n): list.append(i) i = i + 1 for j in range(n): print(list[j], end="")
c3607404f5ac3cc66c9a3222fd122c7e05789569
k5tuck/Digital-Crafts-Classes
/end_of_lesson_exercises/lrg_exercises/python/lrg_exercise2.py
970
3.96875
4
num = int(input("What number would you like to factor?: ")) if num % 2 == 0: print("%i is a positive number" %num) even_list = [] p = 1 while p <= num: if num % p == 0: q = num / p even_list.append(p) even_list.append(int(q)) p += 1 else...
1b658c4f93e2273d593ad60070c170d88b147ce0
k5tuck/Digital-Crafts-Classes
/python/wk_1/comparisons1.py
249
3.90625
4
my_number = 29 compare1 = 18 compare2 = 7 compare3 = 29 if my_number == compare1: print(True) elif my_number == compare2: print(True) elif my_number == compare3: print(True) else: print("This number is equal to none of the above")
bcde179facbf825efb934e779b2257e2e608d211
k5tuck/Digital-Crafts-Classes
/end_of_lesson_exercises/small_exercises/python/wk2_exercise5.py
254
3.875
4
# Exercise 5 numbers = [-23, -52, 0, -1.6, 56, 231, 86, 20, 11, 17, 9] for num in numbers: if num > 0: print(num) # Exercise 6 new_numbers = [] for num in numbers: if num > 0: new_numbers.append(num) print(sorted(new_numbers))
b775e2235930821da179884ff859d592d3d5ada7
k5tuck/Digital-Crafts-Classes
/end_of_lesson_exercises/small_exercises/python/wk2_exercise2.py
246
4.09375
4
numbers = [6,7,8,4,312,109,878] biggest = 0 for num in numbers: if biggest < num: biggest = num else: pass print(biggest) #Alternative using sort method numbers.sort() print(numbers[-1]) #Alternative print(max(numbers))
fe219eb50f78b4c717b8a4a17567073ddb435621
k5tuck/Digital-Crafts-Classes
/end_of_lesson_exercises/small_exercises/python/exercise3.py
310
3.9375
4
print("Please fill in the blanks below:\n") print("____(name)____ loves ____(activity)____ whenever possible!\n") name = input("What is your name? ") activity = input("What is %s's favorite activity to do whenever they get the opportunity? " %name) print("%s loves %s whenever possible!" %(name, activity))
9bdbbea001d9ddbc0c7330ab7b71fc575ac467ce
sankarmanoj/CTE-Python
/second/rand.py
743
3.78125
4
import random import copy randomArray = [random.randint(0,100) for x in range(10)] print "Random Array =",randomArray #Sort Array randomArray.sort() print "Sorted Array = ",randomArray #Largest Element print "Largest Element In Array = ",max(randomArray) #Smallest Element print "Smallest Element in Array = ",min(ran...
7ec2ef1c7ecdc53dadc8c11a3a57fd6da40c1920
sankarmanoj/CTE-Python
/third/third.py
197
3.859375
4
a = range(3) b = range(10,13) c = [] for x in a: for y in b: c.append((x,y)) print c c = [(x,y) for x in a for y in b] print c import itertools c = itertools.product(a,b) print list(c)
0d81f91728bed2c804208f94df5311a26d27df1e
sankarmanoj/CTE-Python
/recur.py
172
3.703125
4
def insertion(a): if len(a)==2: if a[0]>a[1]: a[0],a[1] = a[1],a[0] return a else: return a
c5366570917b06ef617db8abd9c478cbf2c79628
JohnVonNeumann/selenium-py
/custom_logger.py
892
3.53125
4
import inspect #allows users to get info from live objects import logging # the purpose of this file is to act as something of a module that we can # call when needed, it sets itself a name, file and other params. def customLogger(logLevel): # Gets the name of the class / method from where this method is called ...
01412ba71dea158f097e6da5e831c0c7cea44d50
iabok/sales-tracker
/web/sales_app/apps/helpers/processProductSales.py
2,650
3.609375
4
''' Process the product sales fields ''' from collections import namedtuple import operator class ProductSales: """ Product process class """ def __init__(self, product_name, quantity, price): ''' constructor ''' self.product_name = product_name self.quantit...
272adc9f1c787a36e7702e6ee2caa36ae8a547d8
RagingTiger/MontyHallProblem
/montyhall.py
4,080
4.1875
4
#!/usr/bin/env python # libs import random # classes class MontyHall(object): """A class with various methods for simulating the Monty Hall problem.""" def lmad(self): """Interactive version of Monty Hall problem (i.e. Lets Make A Deal).""" # start game print('Let\'s Make A Deal') ...
802f19a0bbe365b4fba2cb6c6d3fbba1db803066
qilinchang70/oh-yeah
/028 星座.py
1,551
3.921875
4
n=eval(input()) for i in range(0,n,1): [month,date]= input().split() month= eval(month) date= eval(date) if month==1 and date >=21: print("Aquarius") elif month==2 and date <=19: print("Aquarius") elif month==2 and date >19: print("Pisces") elif month==3 ...
c47734a966d5996428b2ae19beeb8a396a3c734f
Gouenji/Dynamic-Programming
/Weighted Job Scheduling Dynamic Programming.py
1,699
3.625
4
def doNotOverlap(job1,job2): if job1[0] < job2[0] and job2[1] < job1[1] : return 0 if job2[0] < job1[0] and job1[1] < job2[1] : return 0 if job1[1] > job2[0] and job1[0]<job2[0]: return 0 if job2[1] > job1[0] and job2[0]<job1[0]: return 0 else: return 1 from o...
1b775b3d85e54f9c236f1a4ba71409e99a4ab1d3
Gouenji/Dynamic-Programming
/Maximum Sum Increasing Subsequence Dynamic Programming.py
1,478
3.890625
4
print ("Enter the array to find Maximum Sum Increasing Subsequence (space separated)") a=map(int,raw_input().strip(' ').split(' ')) from copy import copy def MaximumSumIncreasingSubsequence(array): max_sum_array=copy(array) actual_sequence=[] for i in range(len(array)): actual_sequence.append(i) ...
7b709a867ddc325c7f905dcee39dc8a0001ed6b5
prajwaldhore/pythonlab
/ams.py
161
3.65625
4
x=int(input(' enter the number ' )) p=(x//10) q=(x%10) s=(p//10) r=(p%10) z=(s**3+q**3+r**3) if x==z: print('amstrong') else: print('not')
de07a3442ceabc74bbebe758ac77672f8d8441e0
RiderBR/Desafios-Concluidos-em-Python
/Python/Desafio 002.py
250
3.78125
4
#RiderBR-TEKUBR dia = int(input("Qual o dia que você nasceu? ")) mes = str(input("Qual o mês de seu nascimento? ")) ano = int(input("Qual o ano de seu nascimento? ")) print("Você nasceu em {} de {} de {}. Estou correto?".format(dia, mes, ano))
01113ddaf86fac3d3c169ce261a1789ee2731516
RiderBR/Desafios-Concluidos-em-Python
/Python/Desafio 045.py
843
3.84375
4
import random lista = ['Pedra', 'Papel', 'Tesoura'] print('-='*13) print('''Escolha uma das opções: [ 1 ] - Pedra [ 2 ] - Papel [ 3 ] - Tesoura''') print('-='*13) jogador = int(input('Sua escolha: ')) print('-='*13) print('Vez do computador.') pc = random.choice(lista) print('O computador escolh...
e6fa51b5a6851f3536f05d31d4ed14d9394e2e9e
wjdghrl11/repipe
/sbsquiz6.py
418
3.6875
4
# 문제 : 99단 8단을 출력해주세요. # 조건 : 숫자 1 이외의 값을 사용할 수 없습니다. 소스코드를 수정해주세요. # 조건 : while문을 사용해주세요. # """ # 출력 양식 # == 8단 == # 8 * 1 = 8 # 8 * 2 = 16 # 8 * 3 = 24 # 8 * 4 = 32 # 8 * 5 = 40 # 8 * 6 = 48 # 8 * 7 = 56 # 8 * 8 = 64 # 8 * 9 = 72 # """ # 수정가능 시작 num = int(input("8을 입력해 주세요"))
bc1f578d4254a5a6d336acceeb1e0e90bebcdd3a
wjdghrl11/repipe
/sbsquiz5.py
107
3.640625
4
# 반복문을 이용해 1 ~ 10까지 출력해주세요. num = 1 while num <= 10: print(num) num += 1
a2b9d9b20dacdbcf9650b924e27b2be4a55bad61
wjdghrl11/repipe
/quiz8.py
676
3.65625
4
# 1 ~ 10 까지 수 리스트 선언 list1 = [1,2,3,4,5,6,7,8,9,10] print(list1) # 리스트 값 짝수만 가져오기 print(list1[0]) print(list1[1]) print(list1[3]) print(list1[5]) print(list1[7]) print(list1[9]) i = 0 while i < 10 : if list1[i] % 2 == 0 : print(list1[i]) i += 1 # 리스트에 11,13,15 추가하기 list1.append(11) list1.append(13) list1.appe...
0e509745b1acc82ae4142d6b2daafdfde2861533
wjdghrl11/repipe
/4.py
431
3.515625
4
# # 삼자택일, 삼지선다 # a = 0 # if a < 0 : # print("음수") # elif a == 0 : # print("0") # else : # 위에서 조건을 다 끝내고서 맨 마지막 # print("양수") b = 15 if b < 1 : print("1보다 작습니다.") elif b < 3 : print("3보다 작습니다.") elif b < 5 : print("5보다 작습니다.") elif b < 10 : print("10보다 작습니다") else : print("10보다 크거나 같습니다.")
714077f21c473536d8f64b6ba9c1f11c968d172b
wonderfullinux/work
/calculator_challenge2.py
929
3.546875
4
#!/usr/bin/env python3 import sys def calculator(gz): yn = gz - 0.165 * gz - 5000 if yn <= 0: ns = 0 elif yn <= 3000: ns = yn * 0.03 elif yn <= 12000: ns = yn * 0.1 - 210 elif yn <= 25000: ns = yn * 0.2 - 1410 elif yn <= 35000: ns = yn * 0.25 - 2660 ...
15d38f06d05b2330c9d0269c4882c701d371eb69
DiggidyDev/euleriser
/graph.py
7,852
3.671875
4
import random from interface import Interface from node import Node __author__ = "DiggidyDev" __license__ = "MIT" __version__ = "1.0.1" __maintainer__ = "DiggidyDev" __email__ = "35506546+DiggidyDev@users.noreply.github.com" __status__ = "Development" class Graph: """ Graph is an object which represents a ...
d67990ec50f962766c1017b19e5b89f5798fa710
otmaneattou/OOP_projects
/calories_app/temperature.py
1,679
3.625
4
from selectorlib import Extractor import requests class Temperature(): """ A scraper that uses an yaml file to read the xpath of a value It needs to extract from timeanddate.com/weather/ url """ headers = { 'pragma': 'no-cache', 'cache-control': 'no-cache', 'dnt': '1', 'upgrade-i...
ab9343311a6c6d43501b8e2196b1682e3d0398f6
panoptes/PEAS
/peas/PID.py
2,683
3.546875
4
from datetime import datetime class PID: ''' Pseudocode from Wikipedia: previous_error = 0 integral = 0 start: error = setpoint - measured_value integral = integral + error*dt derivative = (error - previous_error)/dt output = Kp*error + Ki*integral + Kd*derivative p...
dd45a9660cfd3f30085b148fbbdc2c57691be9a9
hpvo37/PyGame-games
/GameEffects/ShadowForText.py
1,636
4
4
""" example non-animated entry for the pygame text contest if you would like to change this for your own entry, modify the first function that renders the text. you'll also probably want to change the arguments that your function used. simply running the script should show some sort of example for your text renderin...
549659b57129e8bb0b85738015f4f4d6d4e7ebc0
Machine-builder/python-uno
/scripts/game_logic.py
5,222
3.5625
4
from . import card_logic class UnoPlayer(): def __init__(self): self.hand = [] class UnoGame(): def __init__(self): # create a shuffled uno deck self.deck = card_logic.make_deck() self.players = [] self.players_turn = 0 self.turn_direction = 1 ...
43f6c58538bb2bef37b90e942489e7075af2807c
ah4d1/anoapycore
/src/anoapycore/data/null/__init__.py
1,550
3.65625
4
import numpy as __np import pandas as __pd def count (a_data) : """ Count null in dataframe. You can also use a_data[a_column] or a_data[[a_column1,a_column2,...]] """ return a_data.isnull().sum() def fill (a_data,a_columns,b_fill_with='NA') : a_data[a_columns] = a_data[a_columns].fillna(b...
aaa05eaea50ea34481a5a79b59d4350b747579e6
kdm1171/programmers
/python/programmers/level2/P_땅따먹기.py
1,138
3.78125
4
# https://programmers.co.kr/learn/courses/30/lessons/12913 # DP 문제 # 첫번째 리스트와 두번째 리스트를 비교해서 갈 수 있는 가장 큰 값을 찾고, 두 값을 더한 리스트를 반환하여 마지막 리스트에서 가장 큰 값을 찾음 def getNextList(list1, list2): result = [] for i in range(len(list2)): e = 0 for j in range(len(list1)): if i == j: c...
79457ef52eb3f8bc1de24b46048bdd915b7e95e9
kdm1171/programmers
/python/programmers/level2/P_행렬의_곱셈.py
541
3.6875
4
# https://programmers.co.kr/learn/courses/30/lessons/12949 def solution(arr1, arr2): m = len(arr1) # row n = len(arr2[0]) # col l = len(arr1[0]) answer = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): for k in range(l): answer[i][j] += arr1[...
034168d792c48d2c2117d1f89e5a914487485ab1
kdm1171/programmers
/python/programmers/level2/P_뉴스_클러스터링.py
1,324
3.8125
4
# https://programmers.co.kr/learn/courses/30/lessons/17677 import re def solution(str1, str2): pattern = '[A-Z|a-z]' multiSet1 = [] multiSet2 = [] for i in range(1, len(str1)): s = ''.join(str1[i - 1:i + 1]).upper() if len(re.findall(pattern, s)) == 2: multiSet1.append(s) ...
0a74706da29946c50e28d4ffe12a16f25a243d22
kdm1171/programmers
/python/programmers/level2/P_스킬트리.py
584
3.53125
4
# https://programmers.co.kr/learn/courses/30/lessons/49993 def solution(skill, skill_trees): answer = 0 for skill_tree in skill_trees: skill_comp = [i for i in skill] isMatched = False for s in skill_tree: if s in skill_comp: e = skill_comp.pop(0) ...
8584992389409fee8982a810415847603a5d7728
kdm1171/programmers
/python/programmers/level2/P_전화번호_목록.py
502
3.65625
4
# https://programmers.co.kr/learn/courses/30/lessons/42577 def solution(phone_book): l = sorted(phone_book, key=lambda x: len(str(x))) for i, a in enumerate(l): for j, b in enumerate(l): if i == j: continue if str(b).startswith(str(a)): return F...
07d0e6234ff5ea5faa2b45699616270713889447
Pride7K/Python
/Listas/lista_exercicio8.py
261
3.71875
4
vetor = [] media = 0; for i in range(0,4): vetor.append(int(input("Digite a nota: "))); print(""); for i in vetor: media += i media = media /4 print(f'{vetor[0]} {vetor[1]} {vetor[2]} {vetor[3]} equivale a média = {media}');
4918e2a6e919cbaefc031bdf611398a5a085438a
Pride7K/Python
/Exercicios/for.py
244
3.5
4
contador = 0; for i in range(1,500): validador = 0; validador2 = 0; validador = i % 3; validador2 = i % 2; if validador == 0: if validador2 != 0: contador = contador + i; print(contador);
0e44d31802705bb1c7082d846f7ae35ff161229c
Pride7K/Python
/Listas/lista_exercicio5.py
374
3.90625
4
contador = 0; print("Checando se uma expressão é valida através dos parenteses \n"); expressao = input("Digite a expressão: "); print(""); for i in expressao: if i == "(" or i == ")": contador = contador + 1 contador = contador % 2 if contador == 0: print("Expressão valida !...
a609dd67af83c1bf8302578ec639d3bdfe6fcb8a
Pride7K/Python
/Dicionario/dicionario_exercicio2.py
1,069
4.09375
4
from datetime import datetime pessoa = {} now = datetime.now(); now = now.year pessoa["nome"] = input("Digite o seu nome: "); pessoa["ano de nascimento"] = int(input("Digite o seu ano de nascimento: ")); pessoa["cdt"] = int(input("Digite o sua carteira de trabalho(caso nao tenha digite 0): ")); if(pess...
9ef4f0332e5bdf6d72be3bc23ef5d5dcc7ae8038
Pride7K/Python
/Listas/lista_exercicio7.py
148
3.90625
4
vetor = [] for i in range(0,10): vetor.append(float(input("Digite um numero: "))); print(""); print(sorted(vetor,reverse=True));
f7c61b747436cfcd105a925edd695ac3c8d97279
ksheetal/python-codes
/hanoi.py
654
4.1875
4
def hanoi(n,source,spare,target): ''' objective : To build tower of hanoi using n number of disks and 3 poles input parameters : n -> no of disks source : starting position of disk spare : auxillary position of the disk target : end posit...
1ad945d852351c2fed94dc05e75eade79aff7c48
austonnn/ucsd_bio_2
/bio 2 week 4/1.3.4.py
1,106
3.609375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 21 15:23:09 2018 @author: xiangyin """ """ Spectral Convolution Problem: Compute the convolution of a spectrum. Input: A collection of integers Spectrum. Output: The list of elements in the convolution of Spectrum. If an element has multi...
baf66093d37d83826dd906d458484c653e804597
austonnn/ucsd_bio_2
/bio 2 week 3/1.5.py
2,198
3.953125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 14 11:57:07 2018 @author: xiangyin """ #Counting Peptides with Given Mass Problem: Compute the number of peptides of given mass. # Input: An integer m. # Output: The number of linear peptides having integer mass m. aminoAcid = ['G', 'A', ...
c94f35aaf3c6231e4b07cccc6133fb5f5e490566
psmith586/directory-parsing-python
/filewalker.py
1,877
4.09375
4
#Author: Phillip Smith #recursive keyword search/directory data display #using os library to walk the directory import os #using matplotlib to create xy graph of data import matplotlib.pyplot as plt #init root dir and keyword vars from user root_dir = input("Please enter directory path: ") keyword = input(...
de64db2e733e592558b5459e7fb4fcfd695abd1b
moogzy/MIT-6.00.1x-Files
/w2-pset1-alphabetic-strings.py
1,220
4.125
4
#!/usr/bin/python """ Find longest alphabetical order substring in a given string. Author: Adrian Arumugam (apa@moogzy.net) Date: 2018-01-27 MIT 6.00.1x """ s = 'azcbobobegghakl' currloc = 0 substr = '' sublist = [] strend = len(s) # Process the string while the current slice location is less then the length of t...
abb1b3042edbbf6dee7201817177000cb9bc7d39
theworldcitizen/Web-2021
/cycle3.py
128
3.59375
4
a = int(input()) b = int(input()) for i in range(a, b + 1): if(i**(1/2) == round(i**(1/2))): print(i, end=" ")
5cd4cd9e965fdce1148584357b0fc9e2fc1709df
theworldcitizen/Web-2021
/cycle11.py
98
3.5
4
ans = 0 n = int(input()) for i in range(n): a = int(input()) ans = ans + a print(ans)
65882ab6d3f039036a778f6763725231dc69458c
jadsonpp/ordenacao
/src/PersonHandler.py
954
3.703125
4
class Person: def __init__(self,email,gender,uid,birthdate,height,weight): self.email = email self.gender = gender self.uid = uid self.birthdate = birthdate self.height = height self.weight = weight def showData(self): print("E-m...