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
25d9bba08eb6b53c6ec5125f0f1386ebd3c375f8
tsuji-tomonori/prog
/numer0n/items/double.py
900
3.75
4
from module import standard_numer0n as nm def use(info,turn,digit=3): while True: idx = input(f"{info[not turn]['name']}:表示させたい桁を指定してください") fin_flag, idx = check_idx(idx) if fin_flag: break else: print(idx) print("{0}さんの[{1}]桁目の数値は[{2}]です".format( info[turn]["nam...
9fa0e009c15e00016bfae128e68515f6aaa87e5d
rohanyadav030/cp_practice
/is-digit-present.py
865
4.1875
4
# Python program to print the number which # contain the digit d from 0 to n # Returns true if d is present as digit # in number x. def isDigitPresent(x, d): # Breal loop if d is present as digit if (x > 0): if (x % 10 == d): return(True) else: return(False) ...
702ae99a588af50dc3eb3077d6752c61f341b309
DmitriBabin/babin_homework
/factorial_sequence.py
376
3.703125
4
import math import itertools as it class Factorial: class Factorialiter: def __init__(self): self.i = 1 self.z = 1 def __next__(self): self.z *= self.i self.i += 1 return self.z def __iter__(self): return Factorial.Factorialit...
590dce90d6867aac4436f0c675c0f7266086ee87
DmitriBabin/babin_homework
/euclidian_algorithm.py
876
3.609375
4
import random as rd import math a_number = rd.randint(1, 100) b_number = rd.randint(1, 100) print('gcd(',a_number,',',b_number,')') print('Значение, полученное встроенным алгоритмом = ', math.gcd(a_number,b_number)) def gcd(a_number,b_number): if b_number == 0: return a_number else: return gcd(...
2b125895636c4f44e67d61b346faf6f9e0ffebd5
Andy245Liu/Timato
/screentimer.py
3,807
3.5
4
from datetime import datetime import sqlite3 import sys import time import pyautogui if sys.version_info[0] == 2: import Tkinter tkinter = Tkinter else: import tkinter from PIL import Image, ImageTk first = 0 first2 = 0 #python C:\Users\Ahmad\Desktop\disptest.py conn = sqlite3.connect('Data....
82a3d01659c41567c0dde03c3e14585503b96295
tianwen0110/find-job
/target_offer/print_list_reverse.py
632
4.0625
4
class listnode(object): def __init__(self, x=None): self.val = x self.next = None class solution(object): def reverse_list(self, first): if first.val == None: return -1 elif first.next == None: return first.val nextnode = first l = [] ...
ffd5c6d21ea6dd7630628a0c00af7f7959c710c1
tianwen0110/find-job
/target_offer/从上到下打印二叉树.py
1,024
4
4
''' 从上往下打印出二叉树的每个节点,同层节点从左至右打印。 ''' ''' 相当于按层遍历, 中间需要队列做转存 ''' class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class solution(object): def printF(self, tree): if tree == None: return None list1 = [] list1.appe...
ac78fe36eec01c1077bb1b3f83a454912d917bf0
tianwen0110/find-job
/target_offer/正则表达式匹配.py
1,364
3.703125
4
''' 请实现一个函数用来匹配包括'.'和'*'的正则表达式。 模式中的字符'.'表示任意一个字符,而'*'表示它前面的字符可以出现任意次(包含0次)。 在本题中,匹配是指字符串的所有字符匹配整个模式。 例如,字符串"aaa"与模式"a.a"和"ab*ac*a"匹配,但是与"aa.a"和"ab*a"均不匹配 ''' class solution(object): def match(self, string, pattern): if type(string)!=str or type(pattern)!=str: return None i = 0 ...
0855187a0284322baae4436ab56ffef37c7aed84
tianwen0110/find-job
/target_offer/search_in_2dArray.py
1,533
3.765625
4
''' 在一个二维数组中,每一行都按照从左到右递增的顺序排序 每一列都按照从上到下递增的顺序排序。 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 ''' class Solution(object): def find(self, array, target): if type(target) != int and type(target) != float: return False elif array == []: return False elif type(array[0][0]) !=...
7e349fc201f85a485b7a4da089951ddfaa61b2aa
lxndrblz/DHBW-Programmierung
/Semester_1/Probeklausur.py
1,221
3.953125
4
#encoding=utf-8 ''' 99 Bottles of Beer ''' bottles = 99 while bottles > 1: print(str(bottles) + " bottles of beer on the wall," + str(bottles) + " bottles of beer. If one of those bottles should happen to fall") bottles -= 1 print("One (last) bottle of beer on the wall,") print("One (last) bottle of beer.") pr...
b6b91917c0e09643e6138b40f20e32eb8a088706
lxndrblz/DHBW-Programmierung
/Semester_1/Aufgaben Moodle/Hash.py
1,656
3.71875
4
#!/usr/bin/python # -*- coding: utf-8 -*- import string import random import itertools from random import randint def hashthis(s): h = 0 base = 1 for char in s: h += ord(char) * base base *= 26 return h # Funktion generiert Passwort mittels eines kartesischen Produktes aus dem Buchst...
ffa05f9466c855d31dc19f6b1bf18f4d79a4802b
lxndrblz/DHBW-Programmierung
/Semester_2/ObjektOrientierung/Simulation/SimHuman/matches.py
1,525
3.546875
4
import names import random from SimHuman.men import men from SimHuman.women import women class matches(men, women): def __init__(self, match_men, match_women): self.__men = match_men self.__women = match_women self.__kids = [] #Ability to compare couples def __eq__(self, second): ...
ca9aed93c5422314ee6882a20224ea361401a82d
lxndrblz/DHBW-Programmierung
/Semester_1/Aufgaben Moodle/guess.py
443
3.796875
4
#!/usr/bin/python # -*- coding: utf-8 -*- from random import randint AnzahlVersuche = 1 ZufallsWert = randint(1,20) print "Bitte eine Zahl zwischen 1 und 20 auswählen!" guess = int(input("Ihr Tip: ")) while guess != ZufallsWert: AnzahlVersuche += 1 if(guess>ZufallsWert): print "Zahl ist kleiner" el...
18bde0bbb7b8f371cbbab5d3a73310f823fa3570
amrutha1352/4040
/regularpolygon.py
280
4.28125
4
In [46]: X= float(input("Enter the length of any side: ")) Y= int(input("Enter the number of sides in the regular polygon: ")) import math numerator= math.pow(X,2)*Y denominator= 4*(math.tan(math.pi/Y)) area= numerator/denominator print("The area of the regular polygon is:",area)
34e739ba20d456fad59dbc99ebab0d74be0830d0
folivetti/Category4Programmers
/Monad/monadsLista.py
393
3.5
4
def bind(xs, k): return (y for x in xs for y in k(x)) def geralista(x): return [2*x] def triples(n): return ( (x,y,z) for z in range(1, n+1) for x in range(1, z+1) for y in range(x, z+1) if (x**2 + y**2 == z**2)) f...
34c467f6bcb628d403321d30b29644d35af003f3
jonesm1663/cti110
/cti 110/P3HW2.py
543
4.28125
4
# CTI-110 # P3HW2 - Shipping Charges # Michael Jones # 12/2/18 #write a program tha asks the user to enter the weight of a package #then display shipping charges weightofpackage = int(input("Please enter the weight of the package:")) if weightofpackage<= 2: shippingcharges = 1.50 elif weightofpackag...
619ebd59a6875ca0c6feb9a2074ba5412215c4ae
jonesm1663/cti110
/cti 110/P3HW1.py
820
4.4375
4
# CTI-110 # P3HW1 - Roman Numerals # Michael Jones # 12/2/18 #Write a program that prompts the user to enter a number within the range of 1-10 #The program should display the Roman numeral version of that number. #If the number is outside the range of 1-10, the program should display as error message. u...
dba3fcfadbf30efd044878c01b985dfe8e2e9f91
vishwesh5/HackerRank_Python
/Basic_Data_Types/lists.py
602
3.890625
4
# lists.py # Link: https://www.hackerrank.com/challenges/python-lists def carryOp(cmd, A): cmd=cmd.strip().split(' ') if cmd[0]=="insert": A.insert(int(cmd[1]),int(cmd[2])) elif cmd[0]=="print": print(A) elif cmd[0]=="remove": A.remove(int(cmd[1])) elif cmd[0]=="append": ...
c60a5ffaf75adcbf8d8959e3b544c390a412b4bc
ryan-hill83/updated-calc
/input.py
840
4.03125
4
from calculator import addition, subtraction, multipication, division while True: try: first = int(input("First Number: ")) operand = input("Would you like to +, -, * or / ? ") second = int(input("Second Number: ")) if operand == "+": addition(first, second) ...
ca7dfd42e32443a52c05e2d443398136b2311243
fjesser/datascience
/syntax/m_see_data.py
5,392
3.578125
4
import datetime as dt import numpy as np import pandas as pd pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) def export_dataset_description_to_csv(dataset): ''' Function takes description of dataset and saves it as csv Input: dataset: pd.dataFrame object Returns:...
3e25c1171d4f8d10702ccee6660760d06ff1153a
manabled/01-Hello-Class
/02 guess.py
1,085
4.0625
4
#!/Library/Frameworks/Python.framework/Versions/3.6/bin import sys import random assert sys.version_info >= (3,4), "This script requires at least Python 3.4" guessesTaken = 0 maxGuesses = 5 numRange = 30 print("Welcome to Guess the Number") print("I'm thinking of a number between 1 and 30") print("You ha...
812198bdc5e9bdb1f745f2a0196ee9b8d4f7029d
rlaqhdwns/django1
/django1/src/files/files/2019/02/09/a1.py
1,442
3.5
4
''' def defaultfun(a,b,c,d,e,f=20,g=10): pass def func(a=5,b=10,*args, **kwarges): pass def print_info(**kwarges):#딕셔너리 타입 print(kwarges) def sum(*args):#튜플 타입 print (args) isum = 0 for i in args: isum += i return isum print(sum()) print(sum(10,20,30,40,55...
677ce91ae856a4c1d6135c7a48327fc47bc41f05
derejmi/Algorithm-questions-python
/valid_parenthesis.py
1,062
3.796875
4
class Solution: def isValid(self, s: str) -> bool: #have a hashtable which has the opening parenthesis as keys and the closing as values #loop over the string #if string in ht - add opening p to stack #else compare string to the last parenthesis in the stack (pop of...
6a569d1796355a0393f3e4f9af40644d8d50acb1
Linshengyi-William/CS362-InClassActWeek7
/unittest/test_palindrome.py
696
3.984375
4
import unittest import palindrome print("Please enter a string.") inp = input("String is: ") class TestCase(unittest.TestCase): def test_inputType(self): self.assertEqual(type(inp),type("string")) def test_returnType(self): result = palindrome.isPalindrome(inp) self.assertEqual(t...
818ad247228ec2770d9d7c77e604cf6a2259a2d5
Tanya-2000/CYSEC-GRP-2-
/PYTHON ASSIGNMENT 2/QUES-5.py
262
3.859375
4
def has_33(nums): for x in range(0,len(nums)): if nums[x] ==[3] and nums[x+1]==[3]: return True else: return False print(has_33([1, 3, 3]) ) print(has_33([1, 3, 1, 3])) print(has_33([3, 1, 3]))
521215542619ce7e49fe00e8617227d1a73401bc
AkshayLavhagale/Pylint_Coverage
/fixed_triangle.py
1,321
4.0625
4
""" Name - Akshay Lavhagale HW 01: Testing triangle classification The function returns a string that specifies whether the triangle is scalene, isosceles, or equilateral, and whether it is a right triangle as well. """ def classify_triangle(side_1, side_2, side_3): """Triangle classification method""...
3818d7844a22ff4d6587b5d50b55ee99a9b2a724
MaryHak/Machine-Learning-course
/random forest/logistic_regression.py
1,945
3.765625
4
""" Implementation of logistic regression """ import numpy as np def sigmoid(s): """ sigmoid(s) = 1 / (1 + e^(-s)) """ return 1 / (1 + np.exp(-s)) def normalize(X): """ This function normalizes X by dividing each column by its mean """ norm_X = np.ones(X.shape[0]) featu...
8b11a247b8f6e9ed329e29c7bee289db888e09b7
JustinLaureano/nfl-stats
/Notes.py
1,415
3.6875
4
""" collect all players and stats step 1: collect raw data and save it get schedule get game id get game data loop through range save all data collected in a file i.e. player_stats_17.py collect all stats in file dict or class class DataToDict(): def __init(self, dictionary): for k, v in...
06aec43fb274b37e7e5d8d92809c3d45c8912adf
Mandyp-ool/Lesson2
/ex3.py
1,434
4.09375
4
# Пользователь вводит месяц в виде целого числа от 1 до 12. # Сообщить, к какому времени года относится месяц (зима, весна, лето, осень). Напишите решения через list и dict. season_list = ['зима', 'весна', 'лето', 'осень'] season_dict = {0:'зима', 1:'весна', 2:'лето', 3:'осень'} month = int(input("Введите месяц в виде...
2afd83f3ea59d217f622b7abdfbfce2055639b38
ucabtyi/playground
/py/b_tree.py
5,541
3.890625
4
import sys class Node: def __init__(self, value, l=None, r=None): self.value = value self.l = l self.r = r def __str__(self): s = "value: " + str(self.value) if self.l: s += " L: %s" % str(self.l.value) else: s += " L: None" if s...
bfb650ee9eb5e44a26f2a114ee7810e388c0dccc
FlyingPumba/algo3
/hanoi.py
1,828
3.8125
4
#!/usr/bin/env python import sys import os import time if len(sys.argv) > 2: print "Too many arguments" sys.exit() elif len(sys.argv) == 2: n = int(sys.argv[1]) else: print "Too few arguments" sys.exit() # helper functions def display(): os.system('clear') print "T1: ", list(reversed(towe...
1ce3182ee7cc93e36e6104f6352ccfcc2d592a57
BrayanRuiz/AprendiendoPython
/Compara.py
658
3.921875
4
# Compara.py # Autor: Brayan Javier Ruiz Navarro # Fecha de Creación: 15/09/2019 numero1=int(input("Dame el numero uno: ")) numero2=int(input("Dame el numero dos: ")) salida="Numeros proporcionados: {} y {}. {}." if (numero1==numero2): # Entra aqui si los numeros son iguales print(salida.format(numero1, numero...
18f0fe41b07500f4cc067520d7fc1a40c95382df
hafizmuhammadhamza/LearningPython
/Assignment3/Untitled-1.py
1,951
4.09375
4
Assignment#3 ## calculator val1 = input("Enter first value") val2 = input("Enter 2nd value") operator = input("Enter operator") val1 = int(val1) val2 = int(val2) if operator == '+' : val = val1+val2 print(val,"answer") elif operator == '-': val = val1-val2 print(val,"answer") elif operator =='/' : v...
14f729286c7dd1baad31e91de84f32623aaf4ea3
curiousboey/Split_expense
/main.py
5,449
3.75
4
import numpy as np import cv2 import matplotlib.pyplot as plt Total = int(input("Please enter the total expense: ")) people_money = {'A':0,'Su':0,'Sa':0,'B':0,'Sh':0,'D':0,'K':0, 'U':0, 'J':0} exclude_person= input("Are there people to exclude from the list? (y/n): ") exclude_name2 = 'y' while exclude_name2 == 'y' o...
10fed4644051512c170e4b7486046b989ea914e7
bencheng0904/Python200818_2
/turtle05.py
220
3.640625
4
import turtle screen=turtle.Screen screen a = turtle.Turtle() n=int(input("你要幾邊形:")) for i in range(n): a.forward(100) a.left(360/n) turtle.done()
2a02c14e29e2394226df08d57d452ff6c1feab68
ShrutiAgarwal10/tathastu_week_of_code
/day2/program3.py
396
3.796875
4
s=0 sp=6 for i in range(1,5): for j in range(1,s+1): print(" ", end="") s=s+1 print("*",end="") for k in range(1,sp+1): print(" ",end="") sp=sp-2 print("*") s=3 sp=0 for i in range(1,5): for j in range(1,s+1): print(" ", end="") s=s-1 print("*",end="") f...
e8c123bc4f74385b8c83d21d1d16e806c67c3e29
ShrutiAgarwal10/tathastu_week_of_code
/day2/program2.py
249
4
4
n=int(input("Enter the number: ")) if(n<0): print("Incorrect Input") else: print("Fibonacci series is: ") a=0 b=1 print(a, b, end=" ") for i in range(1,n-1): c=a+b print ( c, end=" ") a=b b=c
2a7106f28502efe3d57e692d8428236b14921945
ShrutiAgarwal10/tathastu_week_of_code
/day2/program5.py
263
4.0625
4
for i in range(3,0,-1): print(i, end="") for j in range(1,i): print("*", end="") print(i,end="") print() for i in range(1,4): print(i, end="") for j in range(1,i): print("*", end="") print(i,end="") print()
439f0067ee46a8dc51afb93675750c267ec6a54a
kimhyunkwang/algorithm-study-02
/2주차/김윤주/숫자 나라 특허 전쟁.py
107
4.09375
4
num = int(input()) sum=0 for i in range(num): if i % 3 ==0 or i % 5 ==0: sum = sum+i print(sum)
3bf16699407123dc74114f452f88bfd6f33914be
kimhyunkwang/algorithm-study-02
/3주차/김현광/해치웠나.py
181
3.640625
4
fight = input() villain = fight.count("(") hero = fight.count(")") if fight[0] == ")": print("NO") elif villain > hero or villain < hero: print("NO") else: print("YES")
b3e26a6e084e4c1b3b14358483e02e8901d52116
kimhyunkwang/algorithm-study-02
/4주차/정소원/4주차_암호 만들기.py
281
3.71875
4
n = int(input()) words = [input() for _ in range(n)] def encryption(s): alpha = [chr(ord('A')+i) for i in range(26)] res = '' for c in s: idx = (ord(c)-ord('A')+1) % 26 res += alpha[idx] return res for word in words: print(encryption(word))
c86c5802eedd1316f0ccd88e91213661ba00ceaf
kimhyunkwang/algorithm-study-02
/3주차/강현우/근거 없는 자신감.py
230
3.75
4
score = list(map(int, input().split())) score.pop(0) average = sum(score) / len(score) good_student = 0 for i in score: if i > average: good_student += 1 print("{:.3f}%".format(round(good_student/len(score)*100,3)))
47ccf26e0a4109f42effb74ebfabbdf5814242e7
kimhyunkwang/algorithm-study-02
/2주차/김현광/무어의 법칙[Moore's Law].py
108
3.71875
4
n = int(input()) SUM = 0 n_str = str(2**n) for i in range(len(n_str)): SUM += int(n_str[i]) print(SUM)
d08aa6822d4f277870069b700c232c8b5550c3a0
kimhyunkwang/algorithm-study-02
/2주차/심재민/숫자 나라 특허 전쟁.py
233
3.84375
4
# 숫자 나라 특허 전쟁 N = int(input()) three = [] five = [] for i in range(1, N): if i % 3 == 0: three.append(i) elif i % 5 == 0: five.append(i) num = three + five print(sum(set(num)))
698b8212c16b1a11a5fb9d63af5db687d404039f
beyzakilickol/week1Friday
/algorithms.py
953
4.1875
4
#Write a program which will remove duplicates from the array. arr = ['Beyza', 'Emre', 'John', 'Emre', 'Mark', 'Beyza'] arr = set(arr) arr = list(arr) print(arr) #-------Second way------------------------ remove_dups = [] for i in range(0, len(arr)): if arr[i] not in remove_dups: remove_dups.appen...
34da44a06b3aa45cf48daa2bb0f967289adaa72b
ArunDhwaj/python
/myoops/oops_depth.py
297
3.59375
4
class Book: def __init__(self, name, pageNumber): self.name = name self.pageNumber = pageNumber hindi = Book('Hindi', 200) java = Book('Java', 590) #english.name = 'English' #english.pageNumber = 2000 print(hindi.name, hindi.pageNumber) print(java.name, java.pageNumber)
7676878c6cf7c1395fde4e3f4f96a650b08556c9
ajh1143/HackerRank_Practice
/TripletComparison.py
1,048
3.59375
4
#Compare values in equal positions of two arrays, awarding a point to the array with the greater value in the comparison point. #If values are equal, no points will be awarded for that comparison. #Return a list of values indicating the score for each array owner, named Alice and Bob #!/bin/python3 import os import s...
73c8c88528e7c980308ade1d8f59545bd9fee2e1
McSwellian/3414-Hackbots-FRC-scouting
/Manual Data Entry.py
1,074
3.546875
4
# -*- coding: utf-8 -*- """ Created on Sun Mar 11 00:12:39 2018 @author: Maxwell Ledermann """ import pickle import os def is_number(inpt): try: float(inpt) return True except ValueError: return False while(True): print("Type 'exit' or 'x' at any time to sa...
32f05d2f45e3bad3e2014e1ba768a6b92d4e67b6
soumyadc/myLearning
/python/statement/loop-generator.py
575
4.3125
4
#!/usr/bin/python # A Generator: # helps to generate a iterator object by adding 1-by-1 elements in iterator. #A generator is a function that produces or yields a sequence of values using yield method. def fibonacci(n): #define the generator function a, b, counter = 0, 1, 0 # a=0, b=1, counter=0 while True: ...
7400c080f5ce15b3a5537f436e3458772b42d801
soumyadc/myLearning
/python/tkinter-gui/hello.py
737
4.21875
4
#!/usr/bin/python from Tkinter import * import tkMessageBox def helloCallBack(): tkMessageBox.showinfo( "Hello Python", "Hello World") # Code to add widgets will go here... # Tk root widget, which is a window with a title bar and other decoration provided by the window manager. # The root widget has to be c...
f79177c85731cb3d855362ae429046af9f26755b
soumyadc/myLearning
/python/tkinter-gui/label-dynamic-content.py
433
3.59375
4
#!/usr/bin/python from Tkinter import * import tkMessageBox def counter_label(L2): counter = 0 L2.config(text="Hello World") top = Tk() top.title("Counting Seconds") logo= PhotoImage(file="/home/soumyadc/Pictures/Python.png") L1= Label(top, image=logo).pack(side="right") L2 = Label(top, fg="green").pack(si...
c553dbc7c7a4d74904c17b53cd050f1448648d2f
tavu/nao_footsteps
/footstep_handler/src/footstep_handler/stepQueue.py
1,077
3.59375
4
import copy class StepQueue(object): _steps = None _nextStep = 0 def __init__(self): self._steps = [] self._nextStep = 0 return def clear(self): self._steps = [] self._nextStep = 0 return def addStep(self, step): new_st...
09605e5fb1a9abd9463bb22d7aa5476a461cdf0a
maarjaryytel/python
/Tund_2/loop.py
898
3.75
4
#while #for #index=100 #teineIndex=10 #print(index) #while index<=10: #print(teineIndex) #index+=1 #index+=100 #if index==5: # print(index) #break #continue #else: #print("Condition is false") #fruits=["apple", "banana", "cherry"] #for x in fruits: #print(x) #for...
10ba8e8b576debb45c7fe3d6fb9caa72fcad6c60
maarjaryytel/python
/Tund_4/kolmnurk.py
701
3.625
4
def kolmnurga_funktsioon(): kolmnurgaAlus=int(input("Sisesta kolmnurga alus (cm): ")) kolmnurgaKõrgus= int(input("Sisesta kolmnurga kõrgus (cm): ")) kolmnurgaPindala=kolmnurgaAlus*kolmnurgaKõrgus/2 ##print("Vastus on: ", kolmnurgaPindala) #parem on returni kasutada return kolmnurgaPindala def ruud...
c3d8d2b2ed1064d21443522737f47d4320f60e16
donariumdebbie/BaekjoonOnlineJudge
/1000/1008.py
393
3.546875
4
# Completed 2017-08-20 # correct code from __future__ import division input_numbers = raw_input() int_nums = [int(item) for item in input_numbers.split()] print int_nums[0]/int_nums[1] # first submitted : correct but runtime error # import numpy as np # input_numbers = raw_input() # int_nums = [int(item) for item ...
11be5b7d615e15e376720def2715bed5b84a43e6
ybgirgin3/tkinter-CRM-gui
/2main.py
6,807
3.5625
4
from tkinter import * from tkinter import ttk import sqlite3 root = Tk() root.geometry("800x500") db_name = "tkinter_db.sqlite3" # create db or connect one conn = sqlite3.connect(db_name) c = conn.cursor() # create table c.execute("""CREATE TABLE if not exists table1 ( ID integer, numara INTEGER, adi TEXT, soy...
00810e6d82eadcefd857be63319e07356c69cf77
stewartad/goodcop-dadcop
/player.py
3,247
3.515625
4
import pygame, constants class Player(pygame.sprite.Sprite): # constrctor class that takes x, y coordinates as parameters def __init__(self, x, y): # call parent constructor pygame.sprite.Sprite.__init__(self) # set sprite image and rectangle self.image = pygame.image.load("good...
29c1733f39888ca54099d2e15a762d8d748c06f9
opiroi/sololearn_python
/assistant/python_iterators_and_generators.py
1,556
4.5
4
def iteration_over_list(): """Iteration over list elements. :return: None """ print("##### ##### iteration_over_list ##### #####") for i in [1, 2, 3, 4]: print(i) # prints: # 1 # 2 # 3 # 4 def iteration_over_string(): """Iteration over string characters. :re...
a80e193e474dbf030fe16d22c4bcc50dba20d6f9
lionfish0/QueueBuffer
/QueueBuffer/__init__.py
3,484
4.1875
4
from multiprocessing import Queue, Value, Manager import threading class QueueBuffer(): def __init__(self,size=10): """Create a queue buffer. One adds items by calling the put(item) method. One can wait for new items to be added by using the blocking pop() method which returns the index and...
e85970fdb453b4554290f61d7b0ef3ecc7ae0028
knoixs/Heard_First
/ceshi.py
1,241
3.578125
4
# class A(object): # def go(self): # print "go A go!" # # def stop(self): # print "stop A stop!" # # def pause(self): # raise Exception("Not Implemented") # # # class B(A): # def go(self): # super(B, self).go() # print "go B go" # # # class C(A): # def go(self...
e667b9b82d8e19fbbbe80b48ea77c3ed37d45528
sathishtammalla/PythonLearning
/Week2/collectionsdemo.py
8,842
4.03125
4
from collections import Counter colls = ['Write a Python program that takes mylist = ["WA", "CA", "NY"] and add “IL” to the list.', 'Write a Python program that takes mylist = ["WA", "CA", "NY", “IL”] and print the list.', 'Write a Python program that takes mylist = ["WA", "CA", "NY", “IL”] and print...
d9416fcdf18c6288f5c0777de675ae3fcf9f599c
sathishtammalla/PythonLearning
/factorial.py
1,273
4.09375
4
5# Regular Factorial Function def factorial(n): num = n fact = 1 if n > 900: print('Number is too big..Enter a number less than 900') n = 1 while num > 1: fact = fact * num num = num - 1 #print(fact) print('Factorial of ' + str(n) + ' is ' + str(fact)) # ...
7b3a4e66395735192270abc17f1c77bc8d5ee5bd
newjoseph/Python
/Kakao/String/parentheses.py
2,587
4.1875
4
# -*- coding: utf-8 -*- # parentheses example def solution(p): #print("solution called, p is: " + p + "\n" ) answer = "" #strings and substrings #w = "" u = "" v = "" temp_str = "" rev_str = "" #number of parentheses left = 0 right = 0 count = 0 # flag correct ...
d17f0a5bc03b4ac03c3c9ed841d221d67866e268
Rahul-Chaudhary-2301/Tic-Tac-Toe-Python
/Tic_Tac_Toe.py
982
3.640625
4
#Tic Tac Toe from Player import Player from UI import UI from Game import Game if __name__ == '__main__': print('Wellcome to X O') print(' 1] Play with CPU\n 2] Play with Human \n 3]Exit') opt = int(input('>')) if opt == 1: pass sel = input('Select X / O : ') if sel ...
40834ff71cc6200a7028bd1d8a7cacf42c9f886e
nicolaetiut/PLPNick
/checkpoint1/sort.py
2,480
4.25
4
"""Sort list of dictionaries from file based on the dictionary keys. The rule for comparing dictionaries between them is: - if the value of the dictionary with the lowest alphabetic key is lower than the value of the other dictionary with the lowest alphabetic key, then the first dictionary is smaller than the second. ...
3e6a7cde7bc3639de439ae27c55bf17cc34a5dcd
Michellinian/unit-3
/snakify_practice/square.py
92
3.921875
4
# A program that takes a number and prints its square a = int(input()) b = (a ** 2) print(b)
532a675840c95eefc4fe9a27f6b5cebe5658bcd7
Michellinian/unit-3
/snakify_practice/prevNext.py
116
3.9375
4
# Read the integer numbers and prints its previous and next numbers num = int(input()) print(num - 1) print(num + 1)
235fd1475b420583988d3f61962a2a043b719b5b
Michellinian/unit-3
/snakify_practice/signFunc.py
190
4.03125
4
# For the given integer X print 1 if it's positive # -1 if it's negative # 0 if it's equal to zero num = int(input()) if num < 0: print(-1) elif num == 0: print(0) else: print(1)
4fe12c2ab9d4892088c5270beb6e2ce5d96debb1
chapman-cs510-2016f/cw-03-datapanthers
/test_sequences.py
915
4.3125
4
#!/usr/bin/env python import sequences # this function imports the sequences.py and tests the fibonacci function to check if it returns the expected list. def test_fibonacci(): fib_list=sequences.fibonacci(5) test_list=[1,1,2,3,5] assert fib_list == test_list # ### INSTRUCTOR COMMENT: # ...
1480d01f8e418339339087623e55c93c3a01ee86
pdtrang/COMP8295-Binf-Algorithm
/suffixarr.py
712
3.546875
4
seq = 'THECATISINTHEHAT' query = 'IN' def Search_str(seq,query): idx = [] for i in range(len(seq)-len(query)+1): if (query == seq[i:i+len(query)]): idx.append(i) return idx def Search(seq, query): l, r = 0, len(SA)-1 while l<=r: mid = (l+r)//2 print(l, mid, r, seq[SA[mid]:]) if seq[SA[mid]:].start...
82568658ecaa75070b2bb60c20f49c59c43f0672
kenguoasd/ichw
/currency.py
2,559
4.09375
4
#!/usr/bin/env python3 """currency.py:用来进行货币的换算的一个函数 __author__ = "Wenxiang.Guo" __pkuid__ = "1800011767" __email__ = "1450527589@qq.com" """ from urllib.request import urlopen #如作业说明,在Python中访问URL a = input() #a为输入的第一个变量 b = input() #b为输入的第二个变量 c = input() #c为输入的第三个变量 def exchange(currency_from, currenc...
c653a9e13975ea2ed34ad45f98c04c07e712e0a8
Chooo4u/Decision-Tree
/problem3.py
15,165
3.59375
4
import math import numpy as np from collections import Counter #------------------------------------------------------------------------- ''' Problem 3: Decision Tree (with Descrete Attributes) In this problem, you will implement the decision tree method for classification problems. You could test the corre...
0bfc113811d704a2aad0b1698df54706fd8e8cb0
ruifgomes/exercises
/numeros_10-20.py
405
4
4
#numeros de 10 a 20 #for sequencia in range(10,20): # print(sequencia) resultado = float(input("Insira o seu resultado: ")) if 0 >= resultado or resultado >= 20: print("Resultado invalido") elif resultado <= 10: print("Insulficiente :( ") elif resultado <= 14: print("Bom :| ") elif resultado ...
f6f19b9d52b40d3f2f560d70864f669ca4da5df0
vdaytona/UNSWResearch
/Fitting/FittingPowerSearchingMethod.py
3,209
3.640625
4
''' Created on 15 Nov 2016 to fit the curve using power search method @author: vdaytona ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import time from sklearn.metrics import r2_score # 1. read in data rawData = pd.read_csv(".\Data\data.csv", header = None) x_data = rawData...
32531f0772951f2fd6642fe775445c7c29cc266e
vsevolodzakk/alien_invasion
/alien_game/ship.py
1,996
3.734375
4
import pygame from pygame.sprite import Sprite class Ship(): def __init__(self, game_settings, screen): """Инициирует корабль и задает его начальную позицию""" self.screen = screen self.game_settings = game_settings # Загрузка изображения корабля self.image = pygame.image.load('images/rocket.pn...
d109b9b4d0728b734b104b99d3d9ae19e6a4bf26
msg4rajesh/Building-Data-Science-Applications-with-FastAPI
/chapter2/chapter2_list_comprehensions_02.py
189
3.515625
4
from random import randint, seed seed(10) # Set random seed to make examples reproducible random_elements = [randint(1, 10) for i in range(5)] print(random_elements) # [10, 1, 7, 8, 10]
c5ba4eb1584f0a92159ac2930bb899e45d45651d
msg4rajesh/Building-Data-Science-Applications-with-FastAPI
/chapter11/chapter11_compare_operations.py
366
3.65625
4
import numpy as np np.random.seed(0) # Set the random seed to make examples reproducible m = np.random.randint(10, size=1000000) # An array with a million of elements def standard_double(array): output = np.empty(array.size) for i in range(array.size): output[i] = array[i] * 2 return output ...
eb0c93ebd736a18a087959cfd68d713e07a965a2
msg4rajesh/Building-Data-Science-Applications-with-FastAPI
/chapter4/chapter4_standard_field_types_01.py
230
3.515625
4
from pydantic import BaseModel class Person(BaseModel): first_name: str last_name: str age: int person = Person(first_name="John", last_name="Doe", age=30) print(person) # first_name='John' last_name='Doe' age=30
4f053e59411e550fde83e90311951c77f0143a0d
jackgoode123/variables
/what is your name.py
160
3.875
4
#jackgoode #09-09-2014 #what is your name first_name = input ("please enter your first name: ") print (first_name) print ("hi {0}!".format(first_name))
ddd45e09f38821920c652af1a89b10c607674806
cem05/108
/unique_conversionround.py
1,186
4.03125
4
#unique conversion problem, something different #Currency Conversion to Euros from US Dollars #1 EURO (EUR) = 1.2043 U.S. dollar (USD) #from https://www.wellsfargo.com/foreign-exchange/currency-rates/ on 10/23/2018 print('This program can be used to convert to Euros from US Dollars.') print('The exchage rate was...
96df74099fa7a2432fb2796df8f440948bf76277
f-bandet/Where-s-The-Money
/wheres_the_money.py
4,730
4.21875
4
### ### Author: Faye Bandet ### Description: Welcome to Where's The Money! This is a program that helps a user ### visualize and understand how much money they spend of various categories of expenditures. ### from os import _exit as exit ### Greeting statement print ('-----------------------------') pr...
a35e944774f76b40797b0d0b03cd97159e2a9a9b
SYiH/little_games_things
/knb.py
2,356
3.90625
4
import random, sys while True: while True: b=('камень','ножницы','бумага') usr=input('Камень, ножницы или бумага? Для выхода: "Выход" ') usr=usr.lower() if usr=='выход': sys.exit() elif usr.isalpha()==False: print('Неверное значение, попробуй...
671ee10d18931cda87cf94638f47747616eaed1c
RyanFatsena/Python_C11_BekerjaDenganDateTime
/Prak1C11.py
601
3.84375
4
#1 from datetime import * def diffDate(i) : listTgl = i.split("-") dateList = [] for x in listTgl : dateList.append(int(x)) kemarin = date(dateList[0], dateList[1], dateList[2]) hariIni = datetime.date(datetime.now()) delta = kemarin - hariIni hasil = delta.days retur...
aad0123b1cbabad5f0fb0f9196628f0a853d28bb
jsteinhauser/Transparent-conductor-solver
/TClayer_GUI.py
4,917
3.515625
4
## Import import tkinter as tk import TClayer as TC from decimal import Decimal ## GUI class GUI(tk.Frame): """ Main GUI heritate from tkinter Frame """ def __init__(self): # Constructor self.mainFrame = tk.Frame().pack() # Main frame self.bui...
a18a4d56a8863c6112864ba0958ece31ea5d24d7
longshuicui/leetcode-learning
/04.排序/692. 前K个高频单词(Medium).py
1,435
3.5625
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/5/20 @function: 692. 前K个高频单词 (Medium) https://leetcode-cn.com/problems/top-k-frequent-words/ 给一非空的单词列表,返回前 k 个出现次数最多的单词。 返回的答案应该按单词出现频率由高到低排序。如果不同的单词有相同出现频率,按字母顺序排序。 示例 1: 输入: ["i", "love", "leetcode", "i", "love", "coding"], k = 2 输出: ["i", "love...
0826e56877d23ee9a6012dd2d8f0f89d0367fed5
longshuicui/leetcode-learning
/01.贪心算法/区间问题/763.Partition Labels (Medium).py
1,048
3.953125
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/02/15 @function: 763. Partition Labels (Medium) https://leetcode.com/problems/partition-labels/ A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one par...
19c9392ec1edf3b17fec038531959b09e3184bdd
longshuicui/leetcode-learning
/08.数据结构/数组/48.Rotate Image (Medium).py
944
3.765625
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/3 @function: 48. Rotate Image (Medium) https://leetcode.com/problems/rotate-image/ 题目描述 给定一个 n × n 的矩阵,求它顺时针旋转 90 度的结果,且必须在原矩阵上修改(in-place)。O(1)空间复杂度 输入输出样例 输入和输出都是一个二维整数矩阵。 Input: [[1,2,3], [4,5,6], [7,8,9]] Ou...
d32283fbe67015b2ac7c4aefeedda87da1acd33b
longshuicui/leetcode-learning
/08.数据结构/优先队列(堆排序)/priority_queue.py
2,033
3.8125
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/4 @function: 优先队列 可以在O(1)时间内获得最大值,并且在O(logn)时间内取出最大值和插入任意值 优先队列常常用堆来实现。堆是一个完全二叉树。其父节点的值总是大于等于子节点的值。堆得实现用数组 , 堆的实现方法: 核心操作是上浮和下沉 :如果一个节点比父节点大,那么交换这两个节点;交换过后可能还会比新的父节点大, 因此需要不断的进行比较和交换操作,这个过程叫上浮;类似的,如果一个节点比父节点小,也需要不断的向下 比较和交换操作,这个过...
d37fd9b2691a2cb11cd6c6d92fd428e32b773153
longshuicui/leetcode-learning
/09.字符串/字符串比较/242.Valid Anagram (Easy).py
907
3.640625
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/7 @function: 242. Valid Anagram (Easy) https://leetcode.com/problems/valid-anagram/ 题目描述 判断两个字符串包含的字符是否 完全相同 (不考虑顺序)。 输入输出样例 输入两个字符串,输出一个布尔值,表示两个字符串是否满足条件。 Input: s = "anagram", t = "nagaram" Output: true 题解 使用哈希表或者数组统计两个字符串中每个字符出现的 ...
4c368fcf33423a8da4337c71271649d8cdcb93f4
longshuicui/leetcode-learning
/12.数学/263. 丑数(Easy).py
786
4
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/04/10 @function: 263. 丑数 (Easy) https://leetcode-cn.com/problems/ugly-number/ 给你一个整数 n ,请你判断 n 是否为 丑数 。如果是,返回 true ;否则,返回 false 。 丑数 就是只包含质因数 2、3 和/或 5 的正整数。 示例 1: 输入:n = 6 输出:true 解释:6 = 2 × 3 示例 2: 输入:n = 8 输出:true 解释:8 = 2 × 2 ...
8e60d212527da25dfcd1d7b46706012f552c61c5
longshuicui/leetcode-learning
/10.链表/160.Intersection of Two Linked Lists (Easy).py
1,379
3.671875
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/8 @function: 160. Intersection of Two Linked Lists (Easy) https://leetcode.com/problems/intersection-of-two-linked-lists/ 题目描述 给定两个链表,判断它们是否相交于一点,并求这个相交节点。 输入输出样例 输入是两条链表,输出是一个节点。如无相交节点,则返回一个空节点。 题解 假设链表A的头节点到相交点的距离为a,距离B的头节点到相交点的距离为b,相交点到 ...
d76d149e9719c27d2bb11132aaf4453ce9394974
longshuicui/leetcode-learning
/06.动态规划/子序列问题/300.Longest Increasing Subsequence (Medium).py
1,557
3.671875
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/2 @function: 300. Longest Increasing Subsequence (Medium) https://leetcode.com/problems/longest-increasing-subsequence/ 题目描述 给定一个未排序的整数数组,求 最长 的 递增 子序列的长度。  注意 按照 LeetCode 的习惯,子序列(subsequence)不必连续,子数组(subarray)或子字符串 (substring)必须连续。 输入输...
20ad59679e55cafeda0c21e4bc11a2abeb5255e5
longshuicui/leetcode-learning
/03.二分查找/1011. 在 D 天内送达包裹的能力(Medium).py
1,734
3.8125
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/4/26 @function: 1011. 在 D 天内送达包裹的能力 (Medium) https://leetcode-cn.com/problems/capacity-to-ship-packages-within-d-days/ 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i个包裹的重量为weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。 ...
dfa2c9a903d36e9c0d41e5112cc689e2fa44f969
longshuicui/leetcode-learning
/06.动态规划/分割类型题/139.Word Break (Medium).py
1,203
3.671875
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/2 @function: 139. Word Break (Medium) https://leetcode.com/problems/word-break/ 题目描述 给定一个字符串和一个字符串集合,求是否存在一种分割方式,使得原字符串分割后的子字 符串都可以在集合内找到。 输入输出样例 Input: s = "applepenapple", wordDict = ["apple", "pen"] Output: true 在这个样例中,字符串可以被分割为 [...
c6a9c8a6da02b290fb10bfcb5e7145aeab575fc8
longshuicui/leetcode-learning
/03.二分查找/旋转数组找数字/540.Single Element in a Sorted Array (Medium).py
1,137
3.578125
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/2/18 @function: 540. Single Element in a Sorted Array (Medium) https://leetcode.com/problems/single-element-in-a-sorted-array/ You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which...
23fec7cac2c6dae1931577d195e554638a949702
longshuicui/leetcode-learning
/07.位运算/477. 汉明距离总和(Medium).py
1,374
3.75
4
# -*- coding: utf-8 -*- """ @author: longshuicui @date : 2021/5/28 @function: 477. 汉明距离总和 (Medium) https://leetcode-cn.com/problems/total-hamming-distance/ 两个整数的 汉明距离 指的是这两个数字的二进制数对应位不同的数量。 计算一个数组中,任意两个数之间汉明距离的总和。 示例: 输入: 4, 14, 2 输出: 6 解释: 在二进制表示中,4表示为0100,14表示为1110,2表示为0010。(这样表示是为了体现后四位之间关系) 所以答案为...
f8133e1eceeec54774ed972bd87e50f3b6da3f6f
billillib/100daysofcode-with-python-course
/days/13-15-text-games/code/game.py
2,595
3.96875
4
import random def main(): print_header() ask_player_name() game_loop(create_rolls()) class Roll: def __init__(self, name): self.name = name self.beats = None self.loses = None def can_defeat(self, beats): if self.beats == beats: return True e...
8551d1220dd96bc945ca0272ffe8c797184d7504
Manisha269/Test
/BackendTask.py
561
3.828125
4
input_string = input("Enter leads of various company: ") userList = input_string.split(",") def leads(User_list): Lead_list={} count={} for i in User_list: domain_name=i[i.index('@')+1:] name=i[0:i.index('@')] if(domain_name not in Lead_list): Lead_list[domain_name]=[] ...
e3ab01a2ae4cb41fed9a8f34ca37b7c83c009304
atominize/textbites
/textbites/api.py
4,818
3.671875
4
#!/usr/bin/env python """ API for textual resources. These are abstract base classes. """ from collections import namedtuple class Resource: """ Represents a textual resource which can provide references into it. """ def name(self): """ Name is the pretty of the top reference. """ return self.top_r...
922071d30c161c1519d7f19910aabf7ba985ae03
FRCTeam1571/Robot2017_Offseason
/Trevor/Interface/runrobotWIP.py
2,840
3.796875
4
#!/usr/bin/env python3 # coding=utf-8 import os import platform # this is to detect the operating system for cross-platform compatibility os.system('color f9') @staticmethod def error(): """ this is used when the program breaks or for stopping the command prompt from closing. """ print("") input("Press ...