blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
1e398537391f40744603c8b337fef71f7ae3eed8
Reisande/ProjectEuler
/Project Euler 12.py
615
3.671875
4
import time start_time = time.time() def divisors(divisors_check): root = int(divisors_check**.5) + 1 divisors_list = [(number, divisors_check/number) for number in range(1, root) if divisors_check % number == 0] return len(divisors_list)*2 def triangle(): triangle_number = 0 triangle_number_lis...
6676596d813d6120804057454a271acbca5c0ca5
tuguin/calculadora
/calculadora.py
782
4.0625
4
class calculator: continuar=0 while(continuar==0): a=int(input("valor de a ")) b=int(input("valor de b ")) soma=a+b sub=a-b multi=a*b div=a/b potencia=1 while (a!=0): potencia=potencia*b a=a-1 ...
36ff08887b4826ef0e11a3f7b419ecbac69aef11
jahonjumanov/python_darslari_2
/python fayllari/09.07.Funksiyalar va proseduralar/6-misol.py
178
3.765625
4
# ikkita sonni kattasini topuvchi funksiya a=int(input("1-son=")) b=int(input("2-son=")) def katta(a,b): if a>b: return a else: return b print(katta(a,b))
6e37e5d5eba5c3c4cbff337ca348b719a0f20bea
kurtrm/linear_algebra_pure
/src/matrix_mismatch_detector.py
551
3.640625
4
""" Function that takes in a bunch of numbers and determines if matrix multiplication can occur. 1223344663322232 011111111 1, 2 1, 3 1, 4 1, 6 1, 3 1, 2 """ from itertools import zip_longest def can_multiply_matrices(*args): """ Takes in a series of tuples and detects whether they can...
5b21b7a26649761899f1270dfe1d0f25ce5df4f0
MinjeongSuh88/python_workspace
/20200724/test8.py
989
3.78125
4
def make2(fn): def test2(): return '곤니찌와' + fn() return test2 # return lambda: '곤니찌와' + fn() # 위의 2줄을 매개변수 없는 람다 함수 한 줄로 표현 def make1(fn): # 함수를 매개변수로 받음 # def test(): # return '니하오' +fn() # return test return lambda: '니하오' + fn() # fn() :매개변수 함수를 실행하기 때문에 함수 f1의 매개변수 fn에 그냥 변수가 대입되면...
d2a562966ea84a22a0d02a0a69b53c113cf00c49
Prithamprince/Python-programming
/string60.py
204
3.59375
4
c=list(input()) d="" e="" for i in c: if(i=="A" or i=="E" or i=="I" or i=="0" or i=="U" or i=="a" or i=="e" or i=="i" or i=="o" or i=="u"): d+=i else: e+=i d+=e print(d)
66e090e9a7e5ee7f12344908b351e003de38ed03
hernamesbarbara/Amortizer
/Loan.py
2,893
4.15625
4
import Amortizer from pprint import pprint as pp class Loan(object): """ Loan class for creating and amortizing loans. """ def __init__(self, amount, interest_rate, term, nper=12): """ Create a new Loan. Args: amount: loan amount interest_rate: nominal in...
0558be126544b48654f350b2ee573a9b9e03853a
ekmahama/Mircosoft
/backtracking/wordSearchII.py
1,349
3.734375
4
class Solution(object): def findWords(self, board, words): """ :type board: List[List[str]] :type words: List[str] :rtype: List[str] """ def backtrack(board, i, j, word): if len(word) == 0: return True if i < 0 or i >= len(board...
a80eae95d240f2b3684c3e816f58794129a4898e
elYaro/Codewars-Katas-Python
/8 kyu/Surface_Area_and_Volume_of_a_Box.py
173
3.578125
4
''' Write a function that returns the total surface area and volume of a box as an array: [area, volume]. ''' def get_size(w,h,d): return[((w*h)+(w*d)+(h*d))*2,(w*h*d)]
732ec77c8672210cc43a66d76d014f0ca1254750
bilalkhan225/pythonpractice
/marksheet.py
652
4.09375
4
english = int(input("enter the marks of english: ")) maths = int(input("enter the marks of maths: ")) urdu = int(input("enter the marks of urdu: ")) sindhi = int(input("enter the marks of sindhi: ")) pakstudies = int(input("enter the marks of pak studies: ")) sum = (english+maths+urdu+sindhi+pakstudies) per = (sum / ...
7d33827cc05d4e11d4e23d41076245a4a7eaa08b
gnyoung19/flask_mortgage_calculator
/affordable_mortgage_function.py
689
3.953125
4
def mortgage_afford(income, down_payment, interest_rate): monthly_income = income/12 mortgage_monthly = monthly_income * 0.25 cost_to_borrow_ten_grand = interest_rate*1000 max_affordable_mortgage = ((mortgage_monthly/cost_to_borrow_ten_grand) * 10000) + down_payment print "Your maximum affordable mortgage is {}."....
594839d495432d84ddd3dd1e0fe83cb92224971c
TomCallR/py_recursive
/tests/test_gift.py
3,870
3.734375
4
import unittest from decimal import Decimal as D from lib.gift import Book, ChocolateType, Chocolate, WithACard, WrappedGift, WrappingPaperStyle, BoxedGift def build_data(): wolfHall = Book(title="Wolf Hall", price=2000) yummyChoc = Chocolate( type=ChocolateType.SeventyPercent, price = 500...
3b91282a27d3d254c221654e54a85fa6e9d13ccb
mehul-prajapati/Programs
/Python_Scripts/1
197
3.609375
4
#!/usr/bin/python # -*- coding: utf-8 -*- def foo(n): count = 1 if n > 0: count += foo(n - 1) + foo(n - 1) print '1' return count print foo(1) print r"hello ew\"
219b68334d8af105c440066a788269d4917b354b
FeminaAnsar/luminarpython
/RegularExpressions/gmail_validation.py
205
3.65625
4
#validate gmail from re import * mail=input("Enter gmail id:") rule="[a-zA-Z0-9.]*@gmail.com" matcher=fullmatch(rule,mail) if matcher ==None: print("invalid gmail id") else: print("Valid gmail id")
cae67c23a375d0154bc4e12db2743a8a8ab9ca77
kaushik-mac/py-wiki
/pywiki/pywiki.py
3,529
3.609375
4
'''01001011 01000001 01010101 01010011 01001000 01001001 01001011 00100000 01000111 01010101 01010000 01010100 01000001''' # '''import all modules needed''' from tkinter import Button, Label, Listbox, PhotoImage, Tk ,Text from tkinter.constants import ACTIVE, END, SINGLE import wikipedia from py_module import ...
0f03d4320e610115a1f5c88b05b06609429a8d32
budaLi/leetcode-python-
/最常见的单词.py
1,239
3.8125
4
# @Time : 2019/9/20 11:12 # @Author : Libuda # @FileName: 最常见的单词.py # @Software: PyCharm class Solution(object): def mostCommonWord(self, paragraph, banned): """ :type paragraph: str :type banned: List[str] :rtype: str """ dic = {} paragraph = self.splitPa...
a4ac7132f6ae6f4a2595b5745ec61d9b299438a7
Htrams/Leetcode
/string_to_integer.py
2,734
3.984375
4
# My Rating = 2 # Same logic can be used in a 32 bit language # https://leetcode.com/problems/string-to-integer-atoi/ # The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus si...
80e303ddbf0ef1c6aeda14572a4aa9d44ca310af
harerakalex/code-wars-kata
/python/RomanNumerals.py
1,835
4.09375
4
''' Create a RomanNumerals class that can convert a roman numeral to and from an integer value. It should follow the API demonstrated in the examples below. Multiple roman numeral values will be tested for each helper method. Modern Roman numerals are written by expressing each digit separately starting with the left ...
9f1a99d9e1a4fd26172773e98b6bf07f710d8a7d
loayyehia9/SMTP
/SMTP.py
2,780
3.53125
4
#import abilities from socket import * msg = "\r\n I love Computer Networks" #body meesage endmsg = "\r\n.\r\n" #character returns and line returns end message #choosing a mail server smtp.gmail.com, 587 #mailserver = ("mail.smtp2go.com", 2525) #Fill in start #Fill in end mailserver = ("smtp.gmail.com", 587) #Fill ...
0199888989e1bb069636d9bcaaea379105482362
batatay/dio-desafio-github
/desafios/aula14___57-65/desafio062.py
567
4.03125
4
#Melhore o DESAFIO 061, perguntando para o usuário se ele quer mostrar mais alguns termos. O programa encerra quando ele disse que quer mostrar 0 termos. termo = int(input('Digite o Primeiro termo: ')) razao = int(input('Digite a Razão: ')) primeiro = termo contador = 1 total = 0 mais = 10 while mais != 0: total = ...
6735e08551253f76ea579b0dd6ca131db4a22b31
marcos-s1/Problemas-Basicos
/Ordenação/ordenador.py
1,186
3.796875
4
class Ordenador: def selecao_direta(self, lista): fim = len(lista) for i in range (fim-1): #Inicialmete o menor elemento ja visto é o i-esimo pos_minimo=i for j in range(i+1, fim): if lista[j]<lista[pos_minimo]: pos_...
d8576813f1bccddb24247fe87de4de49145aea33
magicpieh28/nlp100
/chapter1/05.py
422
3.84375
4
# n-gram def make_word_bi_gram(text: str): word_bi_gram = text.split(' ') return [word_bi_gram[i:i+2] for i in range(len(word_bi_gram) - 1)] def make_char_bi_gram(text: str): char_bi_gram = text.replace(' ', '') return [char_bi_gram[i:i+2]for i in range(len(char_bi_gram) - 1)] if __name__ == '__main...
b107aabc614a2f7e592c0ffca57e9931cc3e896f
MadisonStevens98/Koch-Curve-and-Snowflake-Python
/KochCurveDraw.py
560
4.21875
4
# Write your program below: import turtle import math shape = turtle.Turtle() def drawFractalLine(level, distance): if level == 0: shape.pendown() shape.forward(distance) else: drawFractalLine(level-1, distance/3) shape.left(60) drawFractalLine(level-1, di...
a5d9ed6d6d5ebac0e8d620918f92413b08a8620d
Nordevor/hi
/UTEC/Python/promedio.py
97
3.71875
4
a=0 x=0 z=0 while (a<5): x=int(input("ingresar notas: ")) z=z+x a+=1 print (z/5)
56dfe75099b6fce4e640d5dba505c3714de29cca
chichuyun/LeetCode
/0102/main.py
748
3.75
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if root is None:...
3ac84fa9f1cc787cdcd9c189648c973326072355
Sorbus/artichoke
/authorize.py
1,106
3.890625
4
#!/usr/bin/python #----------------------------------------------------------------------- # twitter-authorize: # - step through the process of creating and authorization a # Twitter application. #----------------------------------------------------------------------- import twitter import time print("1. Create ...
3d21c7ca9a43508349c852c73e7a76c4669f919e
ashvinipadekar/my-django-app
/pythonfull/while program.py
318
4.25
4
""" **** To print the numbers upto 5 count=0 while count<6: print(count) count+=1 *** To print the numbers using break num=1 while num<6: print(num) if num==3: break num+=1 **** To print the no using continew stmt i = 0 while i < 6: i+=1 if i == 3: continue print(i) """
167e5176e5f65d74be1ef800017f5d05f28412fb
Cattleman/python_for_everybody_coursera
/conditional_practice.py
507
4.0625
4
x = raw_input('what is x?') #if statement asks a variable if x < 10: print 'Smaller' if x > 20: print ' Bigger' print 'Finis' if x < 6 : print 'x <6' #two nested ifs y = 101 if y > 1 : print 'More than one' if y < 100: print 'Less than 100' print 'all done' #two-way using else z = 4 if...
fe1d61e28865415d529345742478c2340470f824
PraiseTheDotNet/Python
/lab5/task2.py
478
3.703125
4
import numpy as np if __name__ == '__main__': n = np.array([0]) max_index = -1 for x in range(len(n)): if n[x] == 0 and x + 1 < len(n): if max_index == -1: max_index = x + 1 else: if n[max_index] < n[x + 1]: max_index = x ...
b4b8a1cd3160372d759b43922b3ba9c40878d09c
jonfisik/ScriptsPython
/Scripts10/testLista2.py
1,454
3.96875
4
print('--'*30) nomeIdade = list() nomeIdade.append('Jonatan') nomeIdade.append(39) galera = list() galera.append(nomeIdade[:]) nomeIdade[0] = 'Amanda' nomeIdade[1] = 36 galera.append(nomeIdade[:]) print(galera) print('--'*30) #----------------------------------------------------- galera2 = [['Jonatan',17],['Gabriel',16...
dca7a3c967574e8e6931bfb2372665a1eb036064
Eustaceyi/Leetcode
/289. Game of Life.py
1,168
3.65625
4
class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """ Do not return anything, modify board in-place instead. """ self.row = len(board) self.col = len(board[0]) pos = [(-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)] for i in ra...
f4b1266ce69343825ce2dc449a70ddac3ef7df21
SnipGhost/Python-Lab2
/lab_python_oop/Circle.py
956
3.546875
4
from lab_python_oop.Figure import Figure from lab_python_oop.Color import Color class Circle(Figure): # Add math package to requirements only for PI value? No, thanks! PI_VALUE = 3.14159265359 def __init__(self, radius, color): self.__radius = 0 self.__area = 0 self.radius = radi...
20e0b5d9fbcf575f3406556b88068b98ef821c44
sseering/AdventOfCode
/2017/aoc16.py
4,060
4.09375
4
#!/usr/bin/env python3 # -- Day 16: Permutation Promenade --- # # You come upon a very unusual sight; a group of programs here appear to be dancing. # # There are sixteen programs in total, named a through p. They start by standing in a line: a stands in position 0, b stands in position 1, and so on until p, which sta...
557fb0c440d7835e524bc35562b2bc276539524f
JakobJBauer/CompMath2021
/UE7/Aufgabe6.py
2,191
3.765625
4
# copy from Task 2 from typing import Tuple class Complex: """This class allows to add, multiply and divide two complex numbers""" def __init__(self, z1: Tuple[float, float], z2: Tuple[float, float]) -> None: self.z1 = z1 self.z2 = z2 def add(self) -> Tuple[float, float]: return s...
25bacea962d9ae6a05e2e336a0729f598f20c4b8
StudyGroupPKU/TESTs
/junho/python/chapter01/n2_format.py
350
3.625
4
principal = 1000 rate = 0.05 numyears = 5 year = 1 ''' while year <= numyears: principal = principal * (1 + rate) print(year, principal) year += 1 ''' while year <= numyears: principal = principal * (1 + rate) # print(format(year,"3d"),format(principal,"0.2f")) print("{0:3d} {1:0.2f}".format(ye...
b82ee4b347952f2f5c55aa70025e7fe1639008cb
u3aftab/Project-Euler
/Euler48.py
124
3.5
4
## Find the last ten digits of 1**1 + 2**2 + ... + 1000**1000. a=0 for i in xrange(1,1001): a+=i**i print str(a)[-10:]
9a989933ebfbf402eae8deb7b43087b465f11c09
horacet0728/control_system_examples
/vexvr/proportional_derivative_algorithm_solution_for_template_1.py
3,394
3.5625
4
from math import * from random import randint def proportionalDerivativeControlX(setpoint,duration): maxSpeed = 250 k = 3 kD = 1.5 oldError = 0 # reset the timer brain.timer_reset() # loop while the timer is less than the duration input of the function. while(brain.timer_time(SECONDS...
41df82fe7cc8340d0f8896504ec6bfe98afdea00
dikoko/practice
/2 Sequences/2-47_calculator.py
1,415
4.09375
4
# You have a string of numbers, i.e. 123. # You can insert a + or - sign in front of every number, or you can leave it empty. # Find all of the different possibilities, make the calculation and return the sum. # e.g. # +1+2+3 = 6 # +12+3 = 15 # +123 = 123 # +1+23 = 24 # ... # -1-2-3 = 6 # ... # Return the sum of all th...
919494c7dc4506a65d7b8c6fda245554993474a3
algorithm003/algorithm
/Week_03/id_27/LeetCode_547_27.py
939
3.515625
4
class Solution: def findCircleNum(self, A): N = len(A) seen = set() def dfs(node): for nei, adj in enumerate(A[node]): if adj and nei not in seen: seen.add(nei) dfs(nei) ans = 0 for i in range(N): ...
74433e017e582f18061c30ad762bdfbb3a04611b
EmilyOng/cp2019
/testing/unit_testing/test_age.py
531
3.59375
4
import unittest from age_validation import validate_age class AgeTest (unittest.TestCase): def test_length (self): self.assertEqual(validate_age(""), "Expected an input.") def test_data_type (self): self.assertEqual(validate_age("hlelo"), "Expected a number.") def test_range (self): ...
e4af0ef75e5a02532ee2442fca7f6c6e3947e167
tunealog/python-study
/ex/ex_030_Quiz_Class.py
965
4.21875
4
# Basic of Python # Title : Quiz(Class) # Date : 2020-07-04 # Creator : tunealog # Quiz) Create the real estate program # Example (Result): # Total : 3 # Korea Apartment Buy 10M 2010Y # Japan Office Rental 1M 2007Y # America Gym Monthly 100/10 2000Y class House: def __init__(self, location, house_type, deal_typ...
bab553b86398c1a95198ef2179a5a82fc04ce324
AnnaCilona/PythonExercises
/EjHoja1/3.py
456
4.40625
4
'''Ejercicio 3. Escriba un programa que lea dos números desde teclado y si el primero es mayor que el segundo intercambie sus valores y los muestre ordenados por pantalla (después de haber intercambiado el valor de las variables correspondientes).''' num1=int(input("Escribe un número")) num2=int(input("Escribe un núme...
0f31826fb791c1da3adc2bbfcbbfc3d6688fd6c0
dicksoy/python-learn
/pythonProject/pythonLearn/PythonFunctionTest.py
2,057
4.1875
4
#!/usr/bin/python # -*- coding: UTF-8 -*- # 位置参数 def power(x, n) : s = 1 while n > 0 : n = n - 1 s = s * x return s print(power(5, 2)) print(power(15, 3)) # 默认参数 def power2(x, n=2) : s = 1 while n > 0 : n = n - 1 s = s * x return s print(power2(5)) print(powe...
82e9e29b4f74fc9c36fce86693bc3bd065e9628e
pjlorenz/myappsample
/wordloop.py
1,260
4.0625
4
def word_loop(): # 0 to 9 . how many in the list 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # word = "absolutely" for i in range(len(word)): # we don't want to hardcode 9... we want it to work with any string word # len(word) is 10 <-- that's a clue print(word[len(word) - 1 - i]) ...
ae95cb9f7fa91ae2f2eff0e05358a8d1f5caf0cc
akozubek/python-exercises
/advent-of-code/2017/4-passphrase.py
1,240
3.53125
4
import unittest def isvalid(passphrase): words = passphrase.split() return len(set(words)) == len(words) def isvalid2(passphrase): words = passphrase.split() canonic_words = [''.join(sorted(w)) for w in words] return len(set(canonic_words)) == len(canonic_words) def countvalid(filename, valid_fun...
574db40351dff33a3b4d9139d868635a84953557
arslanislam845/DevNation-Python-assignments
/6.May28/q2.py
662
4.125
4
def values(no): students=[] for i in range(data): print() print("Enter Student",i+1,"name : ") names=input() print("Enter Student",i+1,"age : ") age=int(input()) print("Enter Student",i+1,"phone no : ") phone_no=int(input()) print("Enter Student",i...
065d13f0c32aaabcedd286d10c2d7521b23594ed
ZiHaoYa/1808
/06day/09-异常.py
521
3.515625
4
#coding=utf-8 try: #print(b) #open("1.txt","r") 1/0 #print("老王") except (NameError,FileNotFoundError):#指定异常捕获 print("捕获指定异常") except Exception as ret:#捕获任何异常 ret具体异常信息 print("捕获任何异常") print(ret) else: print("没有任何异常走的逻辑") finally: print("不管有没有异常都会走") ''' 不是所有的代码都需要加上异常 可能会出现一次才加上捕获 ...
15945ecad76a96ffa9dcebbb7b55c31d419da394
mbharanya/Advent-of-code-2020
/day5/day5.py
1,445
3.5625
4
filename = "/home/xmbomb/dev/aoc2020/day5/input.txt" def get_lower_half(list): length = len(list) return list[0:int(length / 2)] def get_upper_half(list): length = len(list) return list[int(length / 2):length] def get_row_col(line): row_numbers = list(range(0, 127 + 1)) col_numbers = list(...
3a7362a62649e7553d9302d4fa415baf8d257190
vadalikasi/python-exercises
/courseware-gen/labs/py3/gen_squares.py
355
3.953125
4
def res_generators(max_value): value = 0 while value < max_value: yield value * value value += 1 def squares(max_value): res = [] for i in range(max_value): res.append(i ** 2) return res if __name__ == '__main__': gen = res_generators(10) for res in gen: p...
8821d761cffc73739155aff5da7bbc96937d9eac
tianyolanda/leetcoding
/leet23-2.py
431
3.765625
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode """ vals = [] for i in lists: ...
a401166f223c115b76388a9ef012a6da04fb0673
ygtfrdes/Program
/Empirical/python/Python-Machine-Learning-Cookbook/Chapter12/pie_chart.py
729
3.78125
4
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt # Labels and corresponding values in counter clockwise direction data = {'Apple' : 26, 'Mango' : 17, 'Pineapple' : 21, 'Banana' : 29, 'Banana2' : 79, 'Strawberry': 11} # List of corresponding ...
8b4da12b88cd47e870130cfd40df71cf3bce28c7
wickyou23/python_learning
/python3_learning/main.py
617
4.09375
4
#Learning python #####Hello word # print("hello word") #####Assigning Values to Variables # x = 100 # pi = 3.14 # empname = "python is great" # a = b = c = 100 # print(x) # print(pi) # print(empname) # print(a, b, c) #####Simultaneous Assignment # d, e = 101, 102 # print(d, e) # e, d = d, e #swap using simultane...
ad2cb20b2e7a95bcccc82cc6eff40d2479015a75
littlelove2013/lab_python_workspace
/general/webbigdata/pagerank/graph.py
691
3.84375
4
# -- coding: utf-8 -- # # PageRank工程的Graph创建程序 # from collections import deque class Graph(): def __init__(self): self.node_n={} def add_nodes(self,nodelist): for i in nodelist: self.add_node(i) #对每一个节点,建一个链表(数组),链表(数组)保存的是其指向的节点 def add_node(self,node): if not node in self.nodes(): self.node_n[node]...
af42a48c0eb66dfcf3137f714f5fe802c435a03a
raiyanshadow/BasicPart1-py
/ex50.py
114
4
4
# Write a Python program to print without newline or space. print("Hello,", sep = "", end="") print(" world")
821234c899f01cf6ba92174c4879c600fcd4bb5b
NejcPivec/FizzBuzz
/fizzBuzz.py
375
3.765625
4
# narediš zanko čez 100 elementov 1- 100 for x in range(1, 101): if x % 3 == 0 and x % 5 == 0: # najprej morš definerat ta pogoj, ker python začčne iz vrha in ga drugače spregleda print("FizzBuzz") elif x % 5 == 0: print("Fuzz") elif x % 3 == 0: print("Fizz") else: prin...
f9bd1a6072637651da4fb3436a6eb56160d0b84c
AlexTargon1/esercizi-informatica-
/03.py
620
3.765625
4
tappa1 = input("inserisci distanza percorsa in km = ") tappa2 = input("inserisci distanza percorsa in km = ") tappa3 = input("inserisci distanza percorsa in km = ") tappa1miglia = int(tappa1)/1.609 tappa1iarde = int(tappa1miglia)*1760 print ("tappa 1 in miglia=",tappa1miglia) print ("tappa 1 in iarde=",tappa1iarde) tap...
ed8f2949054ff42bdc689bd3b481e17a2731e6a8
VincentGFL/python_challenge
/programs/timestable.py
187
3.828125
4
number1 = 1 while number1 <= 10: number2 = 0 while number2 <= 10: number2 += 1 print(number1 * number2, end='\t') print('') number1 += 1
49c82f21838638e507a3a8f7da590b30788a314f
wondershow/CodingTraining
/Python/LC739_DailyTemperatures.py
598
3.703125
4
class Solution: """ Use a monotonic stack to keep all increasing temps indexes. Iterate from last to first REMEMBER to reverse the res """ def dailyTemperatures(self, temperatures: List[int]) -> List[int]: stack, N, res = [], len(temperatures), [] for i in range(N - 1, -1, -...
6159ff567e63acdc5199e416c7bde758c07aee12
MatthewRoberts1/Big-code
/Term 1 Week 4 Challenge 1.py
426
3.71875
4
print("Hello, pleace input what you want to do: R for Read or W for Write") word = input("Input here: ") if word == "R": large = open("D:\Computing stuff\Challenges\BigBoi212.txt", "r") print(large.read()) large.close() elif word == "W": newWords = input("Input the new text: ") small = o...
079b576bb2429b0ac136ea2772d7ab95b648ef6f
Lei-Tin/OnlineCourses
/edX/MIT 6.00.1x Materials/pset2/Paying Debt off in a Year 1.py
690
3.84375
4
# -*- coding: utf-8 -*- """ Created on Fri Feb 5 15:03:11 2021 @author: ray-h """ # Givens # Outstanding balance on the card balance = 484 # Annual interest rate as decimal annualInterestRate = 0.2 # Minimum monthly payment as decimal monthlyPaymentRate = 0.04 # To be solved monthlyInterestR...
faa47569a0feccf599c3f8ea7cc5e54bf02cff11
Shubhampy-code/Let_us_C_book_solution_5th-Edition
/Chapter 5-Functions & Pointers/let_us_c_5_(F_A).py
476
4.125
4
"""Write a function which receives a float and an int from main( ), finds the product of these two and returns the product which is printed through main( ).""" def Product(FirstNumber,SecNumber): product = FirstNumber * SecNumber return product firstNum,secNum = input("Enter the first and second number : ")...
87af6670ec80ac78bb842b3fec2dc767cdf58446
aaronfox/CECS-622-Simulation-and-Modeling
/Homework 03/critical_path_simulation.py
5,745
3.703125
4
# Aaron Fox # CECS 622-01 # Dr. Elmaghraby # Assignment 3 Problem 4 import random # for uniform random distributions of length of process between nodes # Node class is used to contain all info abotu the nodes and their connections and connection lengths class Node: def __init__(self, name): self.node_conn...
732b79b79d35b4d9a26ab5c1228b9e3c1f9eac81
hugo-valle/intro-python
/my_dictionaries.py
1,791
4.1875
4
""" Learn about dictionaries """ from pprint import pprint as pp def main(): """ Test function :return: """ urls = { "google": "www.google.com", "yahoo": "www.yahoo.com", "twitter": "www.twitter", "wsu": "weber.edu" } print(urls, type(urls)) # Access by k...
915f4f7c413609e99f4ed93f5db117997ccb5562
BansiddhaBirajdar/python
/assignment05/ass5Q1.py
583
4.125
4
'''2.Write a program which accept number from user and display its factors in decreasing order. Input : 12 Output : 6 4 3 2 1 Input : 13 Output : 1 Input : 10 Output : 5 2 1''' def factDec(ino): imult=1 print("Output::",end="") if(ino<0): ino=-ino if(ino==0): print("Enter a +ve number") ...
e8110ecb397330ddeb2d99100930118296923c5f
MLMatheus/banco
/gerente/telas/listar.py
283
3.515625
4
from gerente.telas import imprimir def listar(dicionario, chave, numerada): contador = 0 for l in dicionario: if numerada: print("{} - {}".format(contador, dicionario[l][chave])) else: print(dicionario[l][chave]) contador += 1
516c0d7475877db91aca34335516695f4a6c08ee
DevAbdullah7/Mine-Univaresity
/main.py
816
3.625
4
import methods def main(): print('\n\t{} {}/{}/{}\n'.format(methods.time_now.strftime('%A'), methods.time_now.day, methods.time_now.month, methods.time_now.year)) print('For Courses: 1') print('For Requireds: 2') print('For Reports: 3') user = int(input('\n( ch...
3ee0d95c4e729cb5833ecbfe572c17ccc39aa157
AdamZhouSE/pythonHomework
/Code/CodeRecords/2542/60635/260915.py
242
3.53125
4
src=eval(input()) num_set=set(src) longest=0 for num in num_set: curr = 0 if num-1 not in num_set: curr+=1 while num+1 in num_set: num=num+1 curr+=1 longest=max(longest,curr) print(longest)
08c09e9b95ef5e11305b918e273f42093a0e34f4
MiroVatov/Python-SoftUni
/Python Advanced 2021/MULTIDIMESNIONAL_LISTS/Exercise 08.py
3,888
3.671875
4
def find_starting_position(field, size): pos = [] for row in field: for col in row: if col == 's': pos.append(field.index(row)) pos.append(row.index(col)) return pos def valid_position(pos, size): row, col = pos[0], pos[1] ...
754e4cf87805acc755afe9ff9c895f1243f52c05
YertAlan/Yert_Python
/MiscroProject/random_game.py
1,544
3.9375
4
#-*- coding:utf-8 -*- #创建一个摇色子的游戏 import random #生成一个色子的随机数 def ran_num(): list = [1,2,3,4,5,6] n = random.choice(list) return n #将三个色子的随机数进行总和 def ran_sum(): s = 0 list = [] for i in range(3): n = ran_num() list.append(n) s = sum(list) print(list," = ",s) retu...
8ff7ae389b4a3ee40c2f2f9194f2500d4ec7af22
cavandervoort/Project-Euler-001-to-100
/Euler_099.py
1,479
3.640625
4
# Problem 99 # Largest exponential def get_pairs(file_name, permissions): # gets coordinates from file and formats them f = open(file_name, permissions) pairs = [] line_str = ' ' while line_str != '': line_temp = f.readline() line_str = [char for char in line_temp] line_st...
4cb3527fd6ff9db5402c124664f91def8c68b326
Mirgul12/python12
/chapter1.1.py
3,354
4
4
# 1.напишите код ввода двух чисел.Вычислите их разницу # a = int(input('Введите число:')) # b = int(input('Введите число:')) # s = (a - b) # print(s) # 2.вычислите остаток деления 36 на 5 # number1 = 36 # number2 = 5 # print(number1 % number2) # 3.Напишите проверку на то, является ли строка палиндромом. # Палиндро...
8358af3584bc3fe740962bb4893eb4ad63b9b573
emilianot04/Exercise_Python
/The-Python-Workbook/1-Introduction-to-Programming/exercise2.py
238
4.625
5
#Write a program that asks the user to enter his or her name. The program should respond with a message that says hello to the user, using his or her name. name= input('Hello! Insert your name:\n') print('Hello ' + name + '! Welcome')
6249d6087984f287fe34ffe0b9dec7cea34a44a8
nonasi/AI_P2
/multiAgents.py
24,966
3.75
4
# multiAgents.py # -------------- # Licensing Information: Please do not distribute or publish solutions to this # project. You are free to use and extend these projects for educational # purposes. The Pacman AI projects were developed at UC Berkeley, primarily by # John DeNero (denero@cs.berkeley.edu) and Dan Klein (k...
938e05c4eff3d41a71d5290ad6e88359ed51786c
mudassarahmad/python
/calculator.func.py
2,611
4.21875
4
#Calculator Program print " This program is a calculator program" def table(): # print "Please enter the integer for the table" table = int(raw_input("enter table :")) last = int(raw_input("enter last :")) print last start = 1 while start <= last: print ta...
dd6ec30d0e4d93e9ec37cc9645973cd042c592e5
jlreagan/BIOL5153
/chapters5.6.py
1,025
3.8125
4
#####CHAPTER Writing a function #Defining a function def get_at_content(dna): length = len(dna) a_count = dna.upper().count('A') t_count = dna.upper().count('T') at_content = (a_count + t_count) / length return round(at_content, 2) #return at_content will give all numbers #return round(at_content, 2) will ro...
f389d09c593d8924dc41c94ae3ddd0292a5afa1e
hy299792458/LeetCode
/python/606-constructString.py
731
3.75
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 tree2str(self, t): def search(root): re = '' if root == None: return ...
af8d21429e3a481857ae5f59151b06503fdce060
Techsrijan/techpython
/wendingmachine.py
285
3.890625
4
n=int(input("How many toffe u want ?")) stock=15 count=1 while count<=n: if stock>=count: print("Please collect toffee=",count) else: print("Out of stock") break count=count+1 else: # when loop properly runs print("thanks Please visit again")
4f97a07611fd2b524aa789e96d990bd4a3a10f3f
goodnamehadbeeneatbydog/sunPythonLearning
/src/classlearn/定制类.py
10,541
3.9375
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # # 看到类似__slots__这种形如__xxx__的变量或者函数名就要注意,这些在Python中是有特殊用途的。 # # __slots__我们已经知道怎么用了,__len__()方法我们也知道是为了能让class作用于len()函数。 # # 除此之外,Python的class中还有许多这样有特殊用途的函数,可以帮助我们定制类。 # # __str__ # 我们先定义一个Student类,打印一个实例: # # >>> class Student(object): # ... def __init__(self, name): ...
cc61a8f8185bd029b28cd9c95529828e66adb55b
tejaswiniR161/fewLeetCodeSolutions
/Strings/valid_parathesis.py
726
3.703125
4
class Solution: def isValid(self, s: str) -> bool: t=list() t.append(0) for i in range(len(s)): #print(s[i]) if t[-1]=="(" and s[i]==")": #print("previous 1 matched") t.pop(-1) elif t[-1]=="[" and s[i]=="]": ...
d1a54f4aa5b2f4f27ba99696c6a303894a7dc27c
vaios84/Python-Tutorial
/while_loop.py
240
3.703125
4
secretNumber= 12 i=0 guessLimit= 3 while i<guessLimit: guess = int(input('Make a guess (1-20): ')) i++ if guess == secretNumber: print('You won') break else: print('Sorry, you failed. Try again!')
c18cef42358b19686cf114ad74ae03e6318810b4
KorzhMorzh/cs102
/homework01/vigener.py
1,959
3.671875
4
def encrypt_vigenere(plaintext: str, keyword: str) -> str: """ >>> encrypt_vigenere("PYTHON", "A") 'PYTHON' >>> encrypt_vigenere("python", "a") 'python' >>> encrypt_vigenere("ATTACKATDAWN", "LEMON") 'LXFOPVEFRNHR' """ word = [i for i in plaintext] keys = [i for i in keyword*(len(...
6df5cd994892a363fcff45fae7e12ce936569653
advecchia/propor
/propor/src/parse.py
1,171
3.765625
4
import argparse class Parse: """ A class for manipulating the program input. """ def __init__(self): #sys.path.append(os.path.join(os.getcwd(),os.path.dirname(__file__), 'src')) pass def parse(self): parser = argparse.ArgumentParser(description="", formatter_class=argparse.Argu...
550aee15aed8623901e4deeb2e422c96c497adb5
alicihandemir/Patika.dev_Python_Temel_Proje
/Python Proje/flatten.py
256
4
4
def flatten (a,b): for i in a: if type(i) != type([]): b.append(i) elif type(i) == type([]): flatten(i, b) return b arr = [1,2,[3,4,5],6,7,[8,[9,10]]] f_list = [] print(flatten(arr, f_list))
0db34572985497e66c28c8f848bb35e094b8cd48
m104/aoc-2020
/day02.py
2,022
3.53125
4
#!/usr/bin/env python3 # # Debug: # ./day02.py < day02.input.txt # Run: # ./day02.py < day02.input.txt 2>/dev/null import sys lines = [] for line in sys.stdin: lines.append(line.strip()) def parse_first_policy(line): policy_str, letter_str, password = line.split(" ") letter = letter_str[0] low,...
8c01a599a72018ac9c18be14ea0a28104acd42c5
DanielRahme/advent-of-code-2017
/day_4/day_4.py
1,193
3.546875
4
import itertools case_1 = ["aa", "bb", "cc", "dd", "ee"] case_2 = ["aa", "bb", "cc", "dd", "aa"] case_3 = ["aa", "bb", "cc", "dd", "aaa"] case_matrix = [] case_matrix.append(case_1) case_matrix.append(case_2) case_matrix.append(case_3) # Read the input file matrix = [] with open("input.txt", "r") as f: for line...
49a764560e2323d921d082c9f5edecbbc8dc60b6
southpawgeek/perlweeklychallenge-club
/challenge-122/cristian-heredia/python/ch-1.py
752
3.84375
4
''' TASK #1 › Average of Stream Submitted by: Mohammad S Anwar You are given a stream of numbers, @N. Write a script to print the average of the stream at every point. Example Input: @N = (10, 20, 30, 40, 50, 60, 70, 80, 90, ...) Output: 10, 15, 20, 25, 30, 35, 40, 45, 50, ... Av...
bb9c928989b8799406ad6b8cd50c19ca691e31ea
impiyush83/code
/CSCI-B505/assignment5/assignment5_3_1.py
1,629
3.8125
4
import random import sys def get_matrix_dimension(): """ Accepts matrix dimensions :return: list """ first_matrix = input("Enter the dimensions (p) of the matrices you want to" " multiply (separated by space):\n") return [int(j) for j in first_matrix.split()] def brute...
f510d8da99bb4f1f68c37c16e863f67e403cbd47
Banapple01/Coding_Dojo-School-work
/Dojo_Assignments/Algorithms/10-13-2020.py
1,227
4.25
4
import math # Binary Search # Given a sorted list of integers and a number, return a boolean # if that number exists inside the list. # Do not use a for loop to iterate over the entire list. # Input: [1, 2, 3, 4, 5], 5 # Output: True # Input: [2, 4, 6, 8], 9 # Output: False # get middle value # evaluate if < > = # i...
53e96c323ef35ff5e5843c9c8a362d0d0395d299
erickmiller/AutomatousSourceCode
/AutonomousSourceCode/data/raw/sort/c4c131b2-0058-4a25-9810-a563cdd7edfe__keynat.py
504
3.765625
4
def keynat(string): r'''A natural sort helper function for sort() and sorted() without using regular expression. >>> items = ('Z', 'a', '10', '1', '9') >>> sorted(items) ['1', '10', '9', 'Z', 'a'] >>> sorted(items, key=keynat) ['1', '9', '10', 'Z', 'a'] ''' r = [] for...
5f8535f2e7a3ed01d17d4330dd9aee2f2b09f005
adityaskarnik/algorithms
/LinearSearch/linear_search.py
527
3.984375
4
def linearSearch(myList, myItem): found = False position = 0 while position < len(myList) and not found: if myList[position] == myItem: found = True position = position + 1 return found if __name__ == "__main__": shopping = ["apples", "banana"...
26a1610a1c7b729d15811798c8d45b8de5c18d54
lizhenggan/TwentyFour
/01_Language/01_Functions/python/intval.py
2,063
3.578125
4
# coding: utf-8 def intval(var, base=10): if isinstance(var, (int, float)): return int(var) elif isinstance(var, bool): return 1 if var else 0 elif isinstance(var, (list, tuple, set, dict)): return 0 if len(var) == 0 else 1 return int(var, base) if __name__ == '__main__': ...
4071169cfd65608f79e5df4935b44615083dcf4a
CodecoolBP20161/python-pair-programming-exercises-2nd-tw-adam_mentorbot
/palindrome/palindrome_module.py
153
3.578125
4
def palindrome(str): str = str.replace(' ', '').lower() return str == str[::-1] def main(): return if __name__ == '__main__': main()
b4f0a6740fecf50ee54298b170bbe1b2def0735d
kaitorque/ProSolve
/Prosolve-4 2017/C. Alien Communicator/solution.py
218
3.71875
4
T = int(input()) for i in range(T): statement = input() statement = statement.split(" ") statement = statement[::-1] # reverse list new_statement = ' '.join(statement) print(new_statement)
363f36ff7655aa0e07a3ccda6bf16364ed531f91
FrankCasanova/Python
/Sentencias Condicionales/3.2.1-32.py
243
3.609375
4
#Programa de calculo de perimetro y área de un cuadrado con lados de 3 metros. #datos lado = 3 #fórmulas perímetro = lado * 4 área = lado * lado print('El perímetro del cuadrado es {0} y el lado es {1}'.format(perímetro, área))
4e83f0c54270e7dfdcea60260c1a5c47bc701a3c
psitronic/Applied-Cryptography
/One Time Pad/one_time_pad.py
2,999
4.28125
4
""" An implementation of the one-time pad encryption technique. """ def encode_message(msg, key, nbits): """ The function to encrypt a message Takes three arguments: string msg - a message to be encoded string key - a key with the length len(msg) * nbits. If key == None ...
8b5c6733e7a74468c8965e93092cf6f68ccfde8f
ryan-c44/Python-Assignments
/Python Assignments/Assignment1.py
4,255
4.375
4
# Ryan Castles, 6433236, CSIT110 # Question 1 print("Question 1. \n") #Get input from user for title and author. song_title = input("Your favourite song title: ") song_author = input("Your favourite song author: ") print() #print the string using string addition. print("Using string addition") print("Your favourit...
183dddd5ae142eb271ebcad4108d269faaff718e
delisco/algorithm
/sorts/selection_sort.py
1,049
3.78125
4
''' @__date__ = 2020.02.29 @author = DeLi ''' import time def selection_sort(a_list): """ Pure implementation of bubble sort algorithm in Python :param collection: some mutable ordered collection with heterogeneous comparable items inside :return: the same collection ordered by ascending Ex...
8c2173c9ea29fde9bb4f38184e9a8132348b39dd
leewalter/coding
/python/hackerrank/collections.Counter.py
875
3.71875
4
''' https://www.hackerrank.com/challenges/collections-counter/problem ''' import math import os import random import re import sys from collections import Counter if __name__ == '__main__': shoes_count = int(input()) shoes1 = map(int, input().rstrip().split()) # rem to convert from string to int for later mat...
fc02ef2dce4976b9f8e271d217bdc2d5cf7719e8
gsakkas/seq2parse
/src/tests/parsing_test_41.py
349
3.859375
4
class Rect: def __init__(self, l, b): self.length = l self.breadth = b def area(self): return self.length * self.breadth # initialize a Rect object r1 with length 20 and breadth 10 r1 = Rect(20, 10) r2 = Rect(40, 30) print('area of r1 : ', r1.area()) # Rect.area(r1) print('area of r2 : '...
a7d02b2c5a15c63370be6d8e168be499b389282d
Sergey0987/firstproject
/Архив/10_Okno.py
305
3.78125
4
n=int(input("Введите количество бутылок: ")) list1=[] for i in range(n): # Создали список из бутылок list1.append(int(input())) list1=tuple(list1) minim,maxim=int(input()),int(input()) for j in list1: if j<=maxim and j>=minim: print(j)