blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
1b20dfe3d489332858537a73baf4293b448706e8
kirigaikabuto/Python19Lessons
/lesson18/utils.py
195
3.546875
4
def getMax(arr): maxi = arr[0] for i in arr: if i > maxi: maxi = i return maxi def getSum(arr): sumi = 0 for i in arr: sumi += i return sumi
9c4b633b928b7bddd7937fbcf81180ea2be8da05
tgck/uzmz
/jike/turtle_0_04.py
277
3.859375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from turtle import * def main(): reset() shape("circle") pu(); goto(150,0) fillcolor("red") shapesize(5,1,4) for i in range(72): fd(12) lt(5) tilt(7.5) dummy=stamp() if __name__ == '__main__': main() mainloop()
06ed85fd402d9b32454bdb9ec6c18bcfb50b1f28
wondergirl6478/NumberGuessing
/numberguess.py
514
4.125
4
import random introstring = int(input("Guess a number between 1 and 9:-")) print(introstring) randomNo = random.randint(0,9) chances = 0 while chances < 5: if(introstring == randomNo): print("You are correct") break elif(introstring > randomNo): print("Your number is greater than the ...
6c3910621e7dba3f83656dc48a6c8e164c94aaca
zhaoxinlu/leetcode-algorithms
/01Array/055JumpGame.py
534
3.875
4
# -*- coding: utf-8 -*- """ Editor: Zhao Xinlu School: BUPT Date: 2018-03-26 算法思想:贪心--跳跃游戏 """ class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ idx = 0 curSum = 0 while idx<=curSum: curSum = max(curSum, n...
3892269bfb1b5b4422c344cb9feab0829f794b5a
aimemalaika/intro-to-python
/basics II/logical_connector_exercise.py
607
4
4
is_magician = True is_expert = False if is_magician and is_expert: print("You are a magicien and an expert") elif is_magician and not(is_expert): print("You are a magician but not an expert") elif not(is_expert): print("You are an expert") # find highest def highest_event(*args): i = 0 temp = [] while...
95c6fb1a1d3afc1f671bc3804b8452e8c221a20d
Ashitha132/MY_PYTHON
/EXERCISE/mergedic.py
147
3.671875
4
d1={'name':'Sam','age':20,'no':25} d2={'mark1':30,'mark2':35} print("dic 1:",d1," , dic2: ",d2) d1.update(d2) print("merged dictionary:",d1)
4203e852d4da9902face6ed96439d98248bfb129
Conquerk/test
/python/day12/zuoye/3.py
611
3.546875
4
import time # def nao(): # b=int(input("日")) # y=int(input("时")) # m=int(input("分")) # d=int(input("秒")) # l=(2018,9,b,y,m,d,0,0,0) # x=time.mktime(l) # z=time.time() # c=x-z # time.sleep(c) # print("时间到") # nao() def alarm(h,m): print("设置的时间为:%02d:%02d" % (h,m)) while Tr...
3a878f93743876f3f60661397a05022b6710136c
ddtBeppu/introPython3_beppu
/e07/e07_04.py
738
3.703125
4
# 復習課題 7-4 # 古いスタイルの書式指定を使って次の詩を表示し、置換部分に'roast beef', 'ham', 'head', 'clam'を挿入しよう。 # # My kitty cat likes %s, # My kitty cat likes %s, # My kitty cat fell on his %s, # And now thinks he's a %s. # 古いスタイルの書式指定にて文字列を表示 print("My kitty cat likes %s,\ \nMy kitty cat likes %s,\ \nMy kitty cat fell on his %s,\ \...
7074d5c4ffb1f26d4520b8cb311d526f1056c4df
pogross/bitesofpy
/112/username_validator.py
1,470
3.8125
4
# nice snippet: https://gist.github.com/tonybruess/9405134 from collections import namedtuple import re social_platforms = """Twitter Min: 1 Max: 15 Can contain: a-z A-Z 0-9 _ Facebook Min: 5 Max: 50 Can contain: a-z A-Z 0-9 . Reddit Min: 3 Max: 20 Can contain: a-z A-Z 0-9 _ - """ # note range is ...
93ab7fcbe4358f2a9be21fe521e749c98fd1fa93
rfnzrfnzrfnz/Str_easy2
/ft_percent_lower_uppercase.py
195
3.640625
4
def ft_percent_lower_uppercase(str): up = 0 low = 0 for i in str: if i == i.upper(): up += 1 else: low += 1 return up / low * 100
17d4e24a04fad8f0195547fff2b6663bdd6ff10b
pnijhara/python-practice
/mit6.00.1x official/week_2_Simple_programs/ 4.-Functions/eval_quadratic.py
342
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 27 17:56:28 2018 @author: prime """ def evalQuadratic(a, b, c, x): ''' a, b, c: numerical values for the coefficients of a quadratic equation x: numerical value at which to evaluate the quadratic. ''' # Your code here return...
c5f7c58fadb0a9cd145d834557fa08ef7c137f37
lizyang95/leetcode
/leetcode6/intersect.py
628
3.515625
4
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ if not nums1 or not nums2: return [] result = [] n = dict() for i in nums1: if i in n: ...
13adbf9f647a5f2974151efcbc6f98537ee9454b
free-bit/i2dl-HW2
/exercise_code/classifiers/fc_net.py
18,630
3.53125
4
import numpy as np import re from exercise_code.layers import * from exercise_code.layer_utils import * numeric_suffix = lambda text: re.search(r"\d+", text).group(0) class TwoLayerNet(object): """ A two-layer fully-connected neural network with ReLU nonlinearity and softmax loss that uses a modular laye...
d239d8b44d7d22b23684cc579396886407fdd39e
cjayroe/programming-challenges
/linked-list-construction/solution.py
4,174
3.609375
4
# This is an input class. Do not edit. class Node: def __init__(self, value): self.value = value self.prev = None self.next = None # Feel free to add new properties and methods to the class. class DoublyLinkedList: def __init__(self): self.head: Node = None self.tail: N...
adaa94898f36f47779f87a1d6ffeecc89d3e87a2
sayalichakradeo/class-work
/egg.py
315
3.6875
4
inp = input('Enter the file name\n') try: fhand = open(inp) count = 0 for line in fhand: if line.startswith('Subject'): count = count+1 print('the file has ',count, ' subjects') except: if inp.startswith('nana'): print('oopsss!!!! no no!') exit() else: print('file cannot be opened: ',inp) exit()
2d34449da202708854aea350bad976a82e7e6349
HedgehogCode/keras-transfer-learning
/keras_transfer_learning/backbones/convnet.py
3,462
3.859375
4
"""Simple convolutional neural network backbone. """ import keras.backend as K from keras import layers def convnet(filters: list = None, conv_per_block: int = 2, kernel_size=3, activation='relu', batch_norm: bool = False, end_maxpool: bool = False, end_global_maxpool: bool = True, ndims: int ...
7865ef4ecfc34aa0b532f043cd97c9b25c2cf480
Aasthaengg/IBMdataset
/Python_codes/p03231/s196338013.py
407
3.53125
4
import fractions def lcm(a, b): return a * b / fractions.gcd(a, b) N, M = map(int, input().split()) S = input() T = input() d_N = {} for n in range(N): d = fractions.gcd(n, N) d_N[(n // d, N // d)] = n for m in range(M): d = fractions.gcd(m, M) k = (m // d, M // d) if k in d_N: if S...
e9a558717d0240a600605e46541b0207ad58f5b2
othee86/ml
/simulator.py
4,517
3.59375
4
""" This is Santa Uncertain Gifts Simulator """ import os import numpy as np import math import random import click class Horse: def __init__(self, num): self.weight = max(0, np.random.normal(5,2,1)[0]) self.name = 'horse_' + str(num) class Ball: def __init__(self, num): self.weight ...
2ae73b5351a7ea7cbd00b66af0d40578410c4ca3
xiaoloinzi/worksplace
/GR1/APPMBT/graph/Graph.py
1,226
3.515625
4
# encoding=utf-8 import networkx as nx import random # 得到一个图的实例 Graphs = nx.DiGraph() allShortPath = {} def addEdge(sourceNode,dstNode): # 添加边 Graphs.add_edge(sourceNode,dstNode) def printGraph(): # 打印节点 print 'nodes:('+str(Graphs.number_of_nodes())+')'+str(Graphs.nodes()) # 打印边 print 'edges:...
c01d62c403156e3ea03c2db4f8599b35738cb744
sarahwang93/python-leetcode
/binaryTree.py
1,261
3.671875
4
import collections from collections import deque class TreeNode: def __init__(self, x, left, right): self.val = x self.left = left self.right = right class Solution: def isCousins(self, root: TreeNode, x: int, y: int) -> bool: if not root: return root qu...
2bbf399fc463fc77fc91e5f49c3d8bcf7a5e72bd
kidache97/CasualNotes
/leetcode/sort.py
12,689
3.8125
4
# 几种经典的排序算法 # 需要重点关注快速排序、归并排序 # 其次是桶排序、基数排序、希尔排序 import collections from typing import List import heapq import math def selection_sort(nums): # 选择排序 n = len(nums) for i in range(n): for j in range(i, n): if nums[i] > nums[j]: nums[i], nums[j] = nums[j], nums[i] ret...
71d45c84817d437a4efec91af75d5c3cec23b00e
unasuke/AtCoder
/Beginner/13/13-A.py
194
3.875
4
#AtCoder Beginner 13 A str = raw_input() if str == 'A': print "1" elif str == 'B': print "2" elif str == 'C': print "3" elif str == 'D': print "4" elif str == 'E': print "5"
8277177f7d890198adeef413a641c02372a2e3c4
Rahimi0151/chess
/src/Piece_Knight.py
593
3.5625
4
from Piece import Piece class Piece_Knight ( Piece ): def is_allowed_move ( self , toX , toY ): fromX = self.get_position()[0] fromY = self.get_position()[1] if not( ( ( abs( fromX - toX ) ) == 2 ) and ( ( abs( fromY - toY ) ) == 1 ) or ( ( abs( fromX - toX ) ) == ...
e175516f2cc186560b100afdfedbdfc994a21dc5
nikhilraj44/amfoss-tasks
/task-15/euler003.py
328
3.59375
4
import math t=int(input()) for i in range(t): n=int(input()) l=[] while n % 2 == 0: l.append(2) n =int( n / 2) for i in range(3,int(math.sqrt(n))+1,2): while n % i== 0: l.append(i) n =int( n / i ) if n > 2: l.append(n) print(max(l...
f9a6ed61188391ca555a40a8ead0d01085e9e229
RubeusH/Python_Learning
/Chapter-04/Exercises/exercise-06.py
565
4.4375
4
#Write a program that displays a table of the Celsius temperatures 0 through 20 and their #Fahrenheit equivalents. The formula for converting a temperature from Celsius to Fahrenheit is #F=(9/5)C+32 #where F is the Fahrenheit temperature, and C is the Celsius temperature. Your program must #use a loop to display the ta...
47d166b0dcbb9daefa7d7b8dd572be7b8b831914
GuilhermoCampos/Curso-Python3-curso-em-video
/PythonExercicios/Mundo 3/11_tuplas/ex075.py
514
3.890625
4
num = (int(input('Digite um número: ')), int(input('Digite outro valor: ')), int(input('Digite mais um valor:')), int(input('Digite o último valor: '))) print(f'Você digitou os números {num},') print(f'O valor 9 apareceu {num.count(9)} vezes') if 3 in num: print(f'O número 3 apareceu na {num.index(3) + 1}ª p...
1b13ba4f7769a9cd4c07f1b3bd7e3afe418720c6
rldnd111/py3
/ex20.py
606
3.796875
4
# 할인된 상품 가격 출력 def product(): product = {'쌀':9900, '상추':1900, '고추':2900, '마늘':8900, '통닭':5600, '햄':6900, '치즈':3900} return product def computeDiscount(dp): p = product() for k, v in p.items(): price = v * (1 - dp/100) print(f'{k:3s}\t : {v:d}원\t {dp} %DC -...
7fbff18420d5a67273cd5193f1b2df839f052b8f
NineMan/Coursera_PY
/Coursera_PY_week2 47/13 тип треугольника _ с тестом.py
964
3.875
4
#a = int(input()) #b = int(input()) #c = int(input()) def treangle(a, b, c): if a <= b: if b <= c: a1 = a b1 = b c1 = c else: a1 = a b1 = c c1 = b else: if a <= c: a1 = a b...
98dabf0e9571a660567f9ebf2ca71784adeddff3
abouganemi/bois-de-bologne
/Level 2/class - 4/something.py
1,620
3.59375
4
def premier(msg): print(msg) premier("Bonjour") second = premier second("Bonjours") print("#############"*3) def inc(x): return x + 1 def dec(x): return x - 1 def faire(fonc, x): result = fonc(x) return result print(faire(inc, 3)) print(faire(dec, 3)) print("#############"*3) def est_...
6d4a79cb3af2f979263accb0bf3f802028d1134c
fatmbetul/sau-ml
/2-Hafta/Examples/DataPreprocessing/titanic.py
814
3.53125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 3 21:54:28 2018 @author: halil """ import pandas as pd import numpy as np titanic_df = pd.read_csv("./titanic/train.csv") test_df = pd.read_csv("./titanic/test.csv") titanic_df.info() titanic_df.loc[titanic_df["Sex"] == "male", "Sex"] = 0 titan...
c21093f804a69439e7254e0de4cba70abbe3e93f
sandeeppy-ds/Py
/Excercise_1_Problem_4.py
536
4.34375
4
strr = "counting words in a string" count= 1 for i in range(len(strr)): if(strr[i]==' '): count = count + 1 print(count) #prints no.of words in a string print(len(strr)) #prints length of the string def counting_string_words(strr): count= 1 for i in range(len(strr)): if (strr[i] == ' '...
04b8584f1bdda2972d04b3d40a7b2ad74fcf7f93
HediaTnani/Python-for-Bioinformatics
/basic_ops_biopython.py
553
3.65625
4
# some basic operations on a sequence using biopython from Bio.Seq import Seq my_seq = Seq("AGAACCGGTAGCTGACGT") print(my_seq) print(len(my_seq)) print(my_seq[::-1] print(my_seq[0:2]) print(my_seq.count("A")) print(my_seq.count("T")) print(my_seq.count("G")) print(my_seq.count("C")) print(my_seq.reverse_...
c09ec28cff9ba6925361eec35a2c9f1d571659fd
wario2k/Casino-py
/CasinoPy/card.py
1,000
3.78125
4
class Card(): def __init__(self, rank, suit): self.rank = rank self.suit = suit if rank == "A": self.isAce = True def printCard(self): return(self.rank + self.suit) #get numeric value of card def getValue(self): if(self.rank =...
cb81f1132c3498f89b4420af13fa8833bfc6b04d
AgrimNautiyal/Problem-solving
/trees/check_for_bst_inorder.py
634
3.9375
4
#https://practice.geeksforgeeks.org/problems/check-for-bst/1 ''' class Node: def __init__(self, val): self.right = None self.data = val self.left = None ''' def inorder(root, l): if root: l = inorder(root.left, l) l.append(root.data) l = inorder(root.right, l) ...
ac3aebdfd6aa8594499bc8eb2b280b69b24186d2
DemetriusStorm/hacker_rank
/days/day_10_binary_numbers.py
704
3.890625
4
""" Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n's binary representation. When working with different bases, it is common to show the base as a subscript. Example n = 125 The binary representation of 125(base=10) ...
4404a52bff58e265cf1f8f21bc027df842d12e5a
boboran/python-practice
/homework4.py
522
3.546875
4
# a='我爱你一生一世' # print(a) # b=520.1314 # print(b) # c=5211314 # print(c) # num=int(input("请输入一个十进制数:")) # print(str(num)+"的二进制数为:"+str(bin(num))) # print(str(num)+"的八进制数为:"+str(oct(num))) # print(str(num)+"的十六进制数为:"+str(hex(num))) # force = int(input("请输入攻击值:")) # print('攻击 ' + str(force) + " " + int(force/10) * '*...
de1267f8745567fb2a08c77cc4ecb79cd8d00c1f
rolinawu/Small-Projects-PPfromATBSWP
/practice17Nov.py
1,257
3.890625
4
import pprint message = 'It was a bright cold day in ldhjfjkhdajflwkjfkl' count={} for char in message: count.setdefault(char, 0) # ensure the key is in the count dictionary count[char] = count[char] +1 pprint.pprint(count) # prints prettily pprint.pformat(count) # prints it into a string #objective orientati...
a18776af9d2e88dfbe783a96d7d0c52f5a3048d9
navnathsatre/Python-pyCharm
/pyEX_1.py
98
3.765625
4
userInput = input("Enter any number: ") result = 100 / int(userInput) print("Result : ", result)
466043b0b32b6c66c1175c002b6af3d1fa873439
olalis/kody
/python/witaj.py
252
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #osoba = "Jan Kowalski" #osoba = 'Jan Kowalski' osoba = input ('Jak się nazywasz?\n') print('Witaj', osoba , "!") rok = 2017 wiek = int(input ('Ile masz lat\n')) print ('Urodziłeś się w' , rok - wiek , 'roku')
924f89ce17bc97ad505ed8a7f6be60c761c5ab49
hongxchen/algorithm007-class01
/Week_09/G20200343040079/LeetCode_300_0079.py
2,582
3.90625
4
#! /usr/bin/env python # coding: utf-8 # 学号:G20200343040079 """ https://leetcode.com/problems/longest-increasing-subsequence/ 题目描述 300. Longest Increasing Subsequence Medium Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Input: [10,9,2,5,3,7,101,18] Output: 4 Explana...
d4a834c6a8f2daa2527fc5dca17764915da73f96
shawl6201/CTI110
/P4LAB_Shaw.py
1,177
4.125
4
#This program is intended to command the turtle to #create a snowflake through a nested loop. #October 20, 2018 #CTI-110 P4LAB- Snowflakes #Snowflakes #Leslie Shaw def main (): #Open turtle program and change background color import turtle wn = turtle.Screen() wn.bgcolor("blue") #Name...
3461fd23b55064724d4dc3ea783c33514c7cda36
RaymondTomo1/cmpt120Tomo
/#assignment6Problem2.py
637
3.9375
4
# Asks the user for an even numerical input to prove the Goldbach conjecture def isEven (num): if (num % 2) == 0: return True else: return False # JA: 1 is not a prime number def main(): num1 = int(input("Insert an even number into the program:")) if isEven(num1) == True: ...
8afa16a7949e903821e0e579a074c7814bb4f521
mridulpant2010/leetcode_solution
/recursion/2048.py
379
3.53125
4
def find_2048(n): while n: i=n%10 n=n//10 print(d[i],end=' ') def find_n(n,d): if not n: return i =n%10 find_n(n//10,d) print(d[i],end=' ') if __name__ == '__main__': d={ 1:'one',2:'two',3:'three',4:'four', 5:'five',6:'six',7:'seven',8:'eigh...
78ec0e89599aded2cc30525dc7c3bbe92f1cc2c2
iiibsceprana/pranavsai
/functions/funtest5.py
260
3.953125
4
def printinfo( arg1,*vartuple): "this prints a variable passed arguments" print("output is:") print(arg1) print(vartuple) for var in vartuple: print(var) return printinfo(10) printinfo(20,30,40) printinfo(21,23,25,27,29,31,33)
0d03b55c63678458ff13e1496df31617c0ece580
reichunter1656/HackerRank
/Algorithms/Implementation/ExtraLongFactorials.py
144
3.71875
4
#!/bin/python3 import sys def fact(n): if n <= 1: return 1 return n * fact (n - 1) n = int(input().strip()) print (fact(n))
497029a2e40565f86075cbab341d3d48f90ed23a
budaLi/jianzi
/python代码规范demo讲解/2.2异常/demo_02_standard.py
905
3.671875
4
""" 这是demo 02 """ # @Time : 2020/10/27 10:24 # @Author : Libuda # @FileName: demo_02_old.py # @Software: PyCharm # 菜鸟教程 异常处理 https://www.runoob.com/python/python-exceptions.html import os # 1.用户自定义异常类型 class TooLongExceptin(Exception): "this is user's Exception for check the length of name " def __i...
8b0a68cb20d113d3515b2e3afee0d14667ec0387
Progressandro/CalculoComputacional
/biseccion.py
461
3.5
4
import math from tabulate import tabulate def f(x): return x - math.tan(x) def biseccion(a, b, e): c = a results = [[a,b,c]] while((b-a) >= e): c = (a+b)/2 results.append([a,b,c, f(a), f(b), f(c)]) if (f(c) <= e): break if (f(c)*f(a) < 0): b = c else: a = c print('Resul...
f20ddf531fa014c5a1ca1514829196a76393dab9
mossbanay/Codeeval-solutions
/n-mod-m.py
224
3.5
4
import sys def get_remainder(n, m): while n > m: n -= m return n with open(sys.argv[1]) as input_file: for line in input_file.readlines(): n, m = list(map(int, line.strip().split(','))) print(get_remainder(n, m))
abaf9b0ff4c3c68e7daf34277a6b21dfa29fcbae
brthngnsh/Algorithms-in-python
/String/int_to_roman.py
621
3.578125
4
# -*- coding: utf-8 -*- """ Created on Thu Jul 25 15:58:30 2019 @author: PlagueDoctor """ def int_to_roman(s) : roman = {'M':1000 , 'CM':900 ,'D':500 ,'CD':400 ,'C':100 ,'XD':90 , 'L':50 , 'XL':40 , 'X':10 , 'IX':9 , 'V':5 ,'IV':4,'I':1} i = 0 key = list(roman.keys()) val = list(roman.val...
fae5007baa178c6ad524d3f1c210e636eaac9627
SvetlomirBalevski/KiwiTraining
/4/02-Bank-Account/test.py
5,633
4.0625
4
import unittest from datetime import datetime from solution import BankAccount class TestBankAccount(unittest.TestCase): def setUp(self): self.account = BankAccount("Rado", 0, "$") def test_can_create_bank_account(self): '''' Sanity test that nothing went wrong in the init method....
50214d969457953ab61d86380a3c93fc43b60aa9
Snikhil29/Algorithms-Specialization
/Graph Search, Shortest Paths, and Data Structures/2-SumAlgo.py
583
3.5
4
hash = {} count = 0 input_file = open("S:\\Algorithms\\c2\\algo1-programming_prob-2sum.txt", 'r') import os from src.hash_table import two_sum_problem_sort, two_sum_problem_hash from src.heap import Median numbers = [] with open("S:\\Algorithms\\c2\\algo1-programming_prob-2sum.txt".format(base=os.getcwd(...
5a617fd31ec1d8cc8e815290e2fad606d9df63b9
hasankuray/Machine-Learning
/1-Regressions/1.3-Multiple Lineer Regression/multiple_linear_regression.py
935
4.125
4
# simple linear regression y = b0 + b1 * x # multiple linear regression y= b0 + b1 * x1 + b2 * x2.. import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt df = pd.read_csv("dataset_multiple.csv", sep = ";") x = df.iloc[: , [0,2]].values # :...
17de8fd9bfa0cca31fe86eb8e8252aa3222f6dc9
hajdusia/python
/11.0/11.4.py
1,252
3.625
4
#!/usr/bin/python # -*- coding: utf-8 -*- import time import permutations def insertion(data): counter = 0 while counter < len(data) - 1: for i in range(counter + 1, 0, -1): if data[i] < data[i - 1]: data[i], data[i - 1] = data[i - 1], data[i] else: ...
cb5535c12f3fcaf12e2f7ac9fbf4e2c8f280fcf8
9998546789/firstpart
/python/lesson6/Task2.py
1,166
4.21875
4
# 2. Реализовать класс Road (дорога), в котором определить атрибуты: # length (длина), width (ширина). Значения данных атрибутов должны # передаваться при создании экземпляра класса. # Атрибуты сделать защищенными. Определить метод расчета массы асфальта, # необходимого для покрытия всего дорожного полотна. # Использов...
4a7a298837afa894bf41fa119a9dd606d2302df9
Sofista23/Aula1_Python
/Aulas/Exercícios-Mundo1/Aula007/Ex010.py
98
3.765625
4
a=int(input("Quantos reais você possui?:")) d=a/3.2 print("Você possui {0} dólares.".format(d))
7fc7c7919e57fb7390d1de6cc369ed044b894e47
akjha96/eng_to_japanese_translator_offline
/translator_app.py
963
3.953125
4
from translate import Translator def translate_to_japanese(line_to_convert): translator = Translator(to_lang='ja') translation = translator.translate(line_to_convert) return translation while True: try: with open('english.txt', mode='a') as english_to_japanese_file: text = input(...
9edfadc7a701eb89975a45ced042d79e4a405cfc
KubaBrambor/python
/tkinter/pdf.py
573
3.515625
4
from tkinter import * from PIL import ImageTk, Image from tkinter import filedialog root = Tk() root.title("PDF opening") def open(): global my_img top = Toplevel() root.filename = filedialog.askopenfilename(initialdir="/calculator", title="Select A File", filetypes=(("png files", "*.png"),("jpg file", "*...
14c1855b86c79773ccfa7fb1a2fb2f9fe3866af2
Vputri/Python-2
/3.4.py
113
3.9375
4
response = input (" What is your radius? ") r = float(response) area = 3.14159*r**2 print(" The area is ", area)
ebc02b2e6f0711ce37861e8f64e2139df39abb6f
ldpeng/study-code
/Python/commonlib/use_itertools.py
1,563
4.0625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # itertools模块提供的全部是处理迭代功能的函数,它们的返回值不是list,而是Iterator,只有用for循环迭代的时候才真正计算。 import itertools # count()会创建一个无限的迭代器,所以上述代码会打印出自然数序列,根本停不下来 # natuals = itertools.count(1) # for n in natuals: # print(n) # 会把传入的一个序列无限重复下去: # cs = itertools.cycle('ABC') # for c in cs: # ...
eb89ffec162fe4f0e3beb5eabb66ac3bcb086dcb
CatPhD/JSC_Python
/Day 2/W4/p1.py
214
3.890625
4
x = float(input("X: ")) y = float(input("Y: ")) if y > 0: if x > 0: Q = 1 else: Q = 2 else: if x > 0: Q = 4 else: Q = 3 print("Quadrant", Q)
dbce44aa5e7c164b35ed77d8155ea4434e88c179
abhi-verma/LeetCode-Algo
/Python/Number Complement.py
1,144
4.125
4
""" Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of a 32-bit signed integer. You could assume no leading zero bit in the integer’s binary representation. Example 1: Input: ...
2aeba61eeb6da8fa444e31721ee5c4d03eda0e8f
chiragkalal/python_practice_programs
/test.py
523
4.0625
4
"""Que: Given an array of integers, find the highest product you can get from three of the integers. If array size is less than 3, please printout -1. * The range of integer is -1000 to 1000.""" input_array = input() str_nums = input_array.split(',') if len(str_nums) < 3: print(-1) for i, num in enumerate(str_num...
be435cdec5bad8a86c1c6ea2004d2c175185a275
me2001ru/Uppgift-Bibliotek
/funktioner.py
2,007
3.671875
4
# import libraries import datetime def movie_start_worth(cd_price, cd_year, health_grade): # kalla funktion och använd detta värda som argument ! assgin:ar värde till purchase_year för tydlighetens skull. item_age = berakna_ars_differens(cd_year) # kalla funktion och använd detta värda som argument ! ...
1cb8529cf281ab61eeb21bd0f35e1c7e0d5978b1
sajadgzd/csc113practice
/session4/123.py
1,330
3.796875
4
# SAJAD_GHOLAMZADEHRIZI # SESSION AFTERNOON 1 _ InclassAssignment2 import math def milliseconds(minutes): millisec= minutes*60000 print (millisec) return minutes=int(input("Enter time in minutes ")) milliseconds(minutes) def average(test1,test2): return (test1+test2)/2 firsttest = float(input("Enter...
88cab4199d3d66cfb16391b9b9fb0a5ced6eaeca
ivan-ops/progAvanzada
/Ejercicio2.py
131
3.796875
4
#Escribir un programa que le pregunte al usuario por su nombre Nombre = input ('Inserte su nombre : ') print ('Hola' , Nombre)
9fae45646885db1ea6bec03004426d6b08350c58
publiccoding/demorepo
/MyWork/BankingApplication/module/bankingOperation.py
1,865
3.609375
4
from module import userRegistration class bankingOperation: def __init__(self): self.userdata = userRegistration.userRegistration.getValue() self.data_key = self.userdata.values() self.data_value = self.userdata.values () def withdrawAmount(self,username,withdraw): if ...
492d67d363e630033fdcbc719a685992d6ae6307
mitramansouri/LinkedIn-Simulator
/main.py
41,609
3.53125
4
import sqlite3 class linkedin: def __init__(self): self.connection = sqlite3.connect("./myDB.db") self.cursor = self.connection.cursor() self.username = "" self.contact_userid = "" def set_myusername(self, username): self.username = username def cre...
6339afb540613eec8cbd385dd4a47d29ec836831
jiting1014/MH8811-G1901803D
/03/program3.py
848
4.1875
4
print('Welcome!') print('Input the corresponding number of the program you would like to choose. Or input "exit" to quit this program') print("01-Say hello to the world!\n02-Say hello to Someone!\n03-Know the temparature (from Celsius to Fahrenheit)") def a_01(): print('Hello, world!') def a_02(): nam=input('Wh...
e34a09e53e189f9aca97e0121ab2be84d3888a30
mucahidyazar/python
/worksheets/01-basics/09-input.py
532
3.921875
4
#terminalde calistirdigimiz zaman bizden bir sayi isteyecek input() #Terminalde calistiginda icindekini gosterecek ve ayrica inputa bir seyler yazilacabilecek input('Lutfen bir sayi giriniz :') #! a = input('Lutfen bir sayi giriniz : ') print('Kullanicinin girdigi deger : ', a) #Kullanicinin girdigi deger : 50 print...
05959d3d7360135a51bf5e10177a431090c9ef42
Smithmichaeltodd/Learning-Python
/Change.py
571
4.0625
4
#Change.py #A program to calculate the value of some change in dollars def main(): print('Change Counter V 1.0') print() print("Please enter the count of each coin type: ") halfdollars = eval(input('Half Dollars: ')) quarters = eval(input('Quarters: ')) dimes = eval(input('Dimes: ')...
da5da03dee4e209614da26142afc9a7dae4a89d0
srosro/BerryWing
/helloworld/helloworld_LED.py
546
3.734375
4
# Example python pinout program # This will blink an LED every two seconds. # Connect HOT (long wire) on the LED to 3.3v The GND on LED (short wire) should # be connected to this pin (which will short to ground programmatically): LED_GPIO = 20 import time import RPi.GPIO as gpio gpio.setmode(gpio.BCM) gpio.setup(LED...
a9e9cdc7ed4983bb0663f0bdd01a0cab941dd735
Badr-MOUFAD/algorithms-on-graphs
/graph_representation/adjacentListRepresentation.py
2,870
3.734375
4
# The indexing of vertices start from 1 # This convention abide by the representation # given by the course algorithms on graphs # the adopted graph representation is: Adjacent List class Graph: def __init__(self): self.nbVertices = 0 self.nbEdges = 0 self.vertices = dict() self...
cbad4d1fdce93c2f489a53133dc8a7816c688355
nik24g/Python
/calculator.py
480
4.25
4
print(' calculator') print(' -----------') a = input("Please enter the operation ") b = input("please enter 1st number ") c = input("please enter 2nd number ") if a == '+': print(float(b)+float(c)) elif a == '-': print(float(b) - f...
69c3d3318aa8c4db0b38bbcb6f283174f73fedaa
olinkaz93/Algorithms
/Interview_Examples/Leetcode/102_BFSLevelTraversal.py
2,023
4.09375
4
# https://www.youtube.com/watch?v=sFDNL6r5aDM """ 102. Binary Tree Level Order Traversal Medium 4610 106 Add to List Share Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). Example 1: Input: root = [3,9,20,null,null,15,7] Output...
a6ed0340f23ad62bb379de40706e9cf93b296b21
tabish606/python
/addmatrix.py
1,475
4.25
4
m = int(input("enter the row of matrix :")) n = int(input("enter the column of matrix :")) mat1 = [] mat2 = [] for i in range (0,n): mat1.append([]) for i in range (0,m): for j in range (0,n): mat1[i].append(j) mat1[i][j] = 0 for i in range(0,m): for j in range(0,n): print("enter in ...
ed60a036996c10e8fa3b038428de9c3c9126f064
TangentialDevelopment/PythonProjects
/CSE 231/projects/Proj05/FileReaderB.py
2,345
3.921875
4
#ask for the input file name #will continue to prompt until a vlad name is given #smallest mmr #largest mmr #nation rate #michigan rate #average rate while True: #infinitly repeats until the break statment try: input_file_name = str(input("What is the name of the file? ")) input_file =...
434023d78a753b0b395301d49c86933fd2f19e19
amareshadak/python
/Python/string.py
797
4.1875
4
import constant # Add string with single or double code [starting with ''' and end with '''] str = '''Python's course for beginners''' # get string length print(str.__len__()) # get a string from length print(str[5]) # get substring from a string print(str[0:5]) print(str[1:-1]) # Formatting text f_name = "Amares...
b27465d7492e80d0669a9f8ed3c6b45417789bef
abdelaziz21/Python-Reference
/PythonReference.py
15,978
4
4
''' Created on Sep 23, 2017 @author: ****** ''' #variables and types a, b = 3, 4 print(a,b) one = 1 two = 2.0 three = one + two print(three) hello = "hello" world = "world" helloworld = hello + " " + world print(helloworld) mystring = "hello" myfloat = 10.0 myint = 20 if mystring == "hel...
34590510364ddf8cbfff8a8efb900df28a893fbc
katapples/Advent-of-code-2020
/AdventofCodeDay1.py
625
3.9375
4
#find the two (or three for part two) numbers in a text file that add to 2020 and output their product file = open(r"numbersForDay1.txt") arr = file.readlines() #read all lines into an array for a in range(len(arr)): arr[a] = int(arr[a]) #converting to integers # print arr #check the array for i in range (len(a...
288daf5d22965d737b136926128a108abe11c1e0
SnowballSH/Visual-Python
/gui.py
15,787
3.625
4
# GUI using pygame # Imports import json import pygame # import os from pygame.locals import * import compiler pygame.font.init() # Variables FPS = 120 WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) GREY = (198, 214, 198) GREYN = (50, 59, 58) SEA_GREEN = (0, ...
d65cfa323ae83ec3a180d2a49d5cc6bda02f80bb
dqmcdonald/MazeChallenge
/Maze.py
17,411
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 27 20:55:21 2017 Low level Maze Class - Handles keeping track of the cells Maze is stored as a 2D Numpy array of CellType enums. 0 is empty, 1 is a wall, 2 is the start, 3 is the destination etc. @author: que """ import numpy from...
263a148913e44ea49c9184c39552a75c797c1e28
amanbhal/ImportantQuestions
/MaxBinaryGap.py
747
4.21875
4
""" Get maximum binary Gap. For example, 9's binary form is 1001, the gap is 2. """ #=> Using Bit Manipulation #=> The key to solve this problem is the fact that an integer x & 1 will get the last digit of the integer. def maximumGap(nums): maxGap = 0 currGap = -1 #initialized with -1 because only 1 will ...
3a1fb25f2d8cfa47d0afb07607478c763c8005f3
shubhamroy01/Python1.0
/a 13Multipleassignment.py
72
3.625
4
x=10 print('x='+str(x)) x=20 print('x='+str(x)) x=30 print('x='+str(x))
44be18a1eeea67d738e908c6714ee06298da140a
alberto-uni/portafoglioVoti_public
/Algoritmi/2020-07-14/all-CMS-submissions-2020-07-14/20200714T110946.VR451051_id596wge.align_one_string.py
1,990
3.515625
4
""" * user: VR451051_id596wge * fname: ALESSIA * lname: BODINI * task: align_one_string * score: 2.0 * date: 2020-07-14 11:09:46.224227 """ def find_string(row, start_col): if row >= n: return 0 min_45 = 1000000 count = 0 for col in range(start_col, m): if a[col] != b[row]: ...
82c6703887e2a18de441fd2508ff6a010937acf0
jmazzitelli/test
/python-tutorial/simple.py
2,242
3.9375
4
#/usr/bin/python print "--if statement" x = int("1") #raw_input("Please enter an integer: ")) if x < 0: x = 0 print 'Negative changed to zero' elif x == 0: print 'Zero' elif x == 1: print 'Single' else: print 'More' print "--for loop" words = ['cat', 'window', 'defenestrate'] for w in words[:]: ...
dffe89a51676c46df62538c39b9a6da6ed251296
BogdanTelepov/pythonPractice
/guessingGame.py
676
4.0625
4
import random guessing_number = None computer_guess_number = random.randint(1,10) while True: guessing_number = int(input('Guess a number between 1 to 10: ')) if guessing_number < computer_guess_number: print('Too low, try again!') elif guessing_number > computer_guess_number: print('Too h...
08f8174fa9749d8817daefd1a7435fc1db6871de
cbuzzhasAdog/UI
/Tester.py
6,524
3.75
4
# # from tkinter import * # # # # def sel(num): # # selection = "Value = " + str(num) # # label.config(text = selection) # # var = num # # # # # # # # root = Tk() # # var = DoubleVar() # # scale = Scale( root, variable = var,command=sel) # # scale.pack(anchor=CENTER) # # # # # # # # label = Label(root) # # lab...
77a501ffc37778e055246a6df62ddbb1342fff95
AdamZhouSE/pythonHomework
/Code/CodeRecords/2689/61135/300259.py
359
3.53125
4
T=int(input()) for a in range(0,T): inp=input().split(" ") str1=inp[0] str2=inp[1] if(len(str1)==3 and len(str2)==3): print(6) elif(len(str1)==2 and len(str2)==2): print(4) elif(len(str1)==4 and str2=="jghi"): print(7) elif(len(str1)==4 and str2=="xycd"): prin...
a3f7d1d588ca3c6a5528dc2e2e92dea8748dc0cf
Nik6511/Booky.com
/BookStore.py
7,138
3.796875
4
class B(object): def buy(self): n=int(input("Select your payment method\n 1. Card\n 2. UPI\n")) if n==1: d1=input("Enter your 16 digit card Number\n") d2=input("Enter your CVV\n") len1=len(d1) len2=len(d2) ...
0e42f14af4d44b737d118c4f2fe4feb76a4dae24
zeusAtr/test_my
/python_project/samples/ex_11_sum_args.py
355
3.765625
4
__author__ = 'Vlad' def sum_arg(*args): a = len(args) if a == 2: rez = 2 descr ='There are two values in argument' elif a < 2: rez = -1 descr = 'There are less two values in argument' else: rez = 0 descr = 'There are more two values in argument' retur...
5fdb5ea1f05cdf54ff20e23596ce6e59e2d97b0b
Hariniraghavan12/ProblemSet03
/7.using_only.py
472
4.03125
4
flag=0 def using_only(word,list_str): for i in word: if i in list_str: flag=1 else: flag=0 break if flag==1: return True else: return False word_str=raw_input("enter a word:") word_str.lower() word_list=word_str.split(' ') wo...
3d7869854f3627311b20d14d5082a23c9831f43f
jarelio/FUP
/Lista 1/1l.py
458
3.9375
4
num_horatrab = int(input("Digite o número de horas trabalhadas: ")) salariomin = float(input("Digite o valor do salário mínimo: ")) num_horaext = int(input("Digite o número de horas extras: ")) hora_trab = salariomin/8 hora_extra = salariomin/4 salario_bruto = (num_horatrab * hora_trab) receber_hora_extra = (num_horae...
41a495614999b61875db35773760cfec44f42f4d
adityakrshnn/NAS
/p02.py
544
3.90625
4
import datetime if __name__ == '__main__': dateFrom = datetime.date(1990,1,1) dateTo = datetime.date(1999,12,31) d = dateTo - dateFrom days = d.days weeks = days//7 extraDays = days%7 #print(weeks) #print(extraDays) day1 = dateFrom.weekday() #print(day1) day2 = ...
8c91dea5f06e6e4b6e3ae55b65c7fe5335089ddd
mkuncham/DS5001
/CAPM.py
5,271
3.765625
4
#!/usr/bin/env python # coding: utf-8 # ## Capital Asset Pricing Model (CAPM) # ### Strength Training with Functions, Numpy # # # ### University of Virginia # ### DS 5100: Programming for Data Science # ### Last Updated: March 18, 2021 # --- # ### Objectives: # - Use numpy and functions to compute a stock's CAPM b...
9acbde389d7a7fe5876f87b3711cb9cdde4603be
jackwillson642/Python
/guessMyNumber.py
376
3.890625
4
from random import * randNum = randint(1,20) print("I'm thinking of a number between 1 and 20") a = int(input("Take a guess: ")) c=1 while True: if(a == randNum): print("Correct") break elif(a > randNum): print("Too high") else: print("Too low") a = int(input("Try a...
af1f52946a80072d5c0900ca2cb1c10f758509a9
bunnyxx/python
/leetspeak converter.py
279
4.09375
4
replacements = ('a', '4'), ('b', '8'), ('f', 'ph'), ('g', '9'), ('e', '3'), ('o', '0'), ('s', '2'), ('t', '7'), ('z', '2') phrase = input("Input verse: ").lower() newPhrase = phrase for old, new in replacements: newPhrase = newPhrase.replace(old, new) print(newPhrase.upper())
067a21b93e6a79f3407a7c9ef85f4779e2da9a13
ganesh909909/html-bootstrap
/static variables.py
2,553
4.125
4
# class student: # cname='CMR Institute' # def __init__(self,name,rollno): # self.name=name # self.rollno=rollno # s1=student('rahul',101) # s2=student('pavan',102) # print(s1.name,s1.rollno,student.cname) # print(s2.name,s2.rollno,s1.cname) # what are various places are there to declare stati...
f7276b3aa49ae1a91ba88ac522400fc20ddd2b1a
MingjuiLee/products
/products.py
1,981
3.78125
4
import os # operating systen # read file: 只做read file的部分 不做檢查檔案是否存在 def read_file(filename): products = [] with open(filename, 'r', encoding='utf-8') as f: for line in f: # line is string if 'Product,Price' in line: continue # 繼續 name, price = line.strip().split(',') # 先把換行符號\n去掉 在進行split(',') 用逗點,當作...
f502c4d07ae09f59e2c4a7f2e1bccda6ec1be6bf
TasnimKT/Projet-S3
/Interface_graphique.py
1,496
3.59375
4
# -*- coding: utf-8 -*- """ Created on Wed Nov 7 09:48:03 2018 @author: etudiant """ #from tkinter import * import tkinter as tk def recherche (): txt = canvas.create_text(75, 60, text='yo', font="Arial 16", fill="black") entre = entree.get() if entre =='lol': app = "cool" print("cool") els...
a9a4d610cf883c5156b378209be13d9cb48a6d55
shamanengine/HackerRank
/src/13_regex_and_parsing/re_sub.py
1,249
3.859375
4
""" && → and || → or Both && and || should have a space " " on both sides. Input Format The first line contains the integer, N. The next N lines each contain a line of the text. """ import re for _ in range(int(input())): s = input() s = re.sub(r'(?<=\s)&&(?=\s)', "and", s) s = re.sub(r'(?<=\s)\|\|(?=\s)...