blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
1f2b1c0f66ca6d9b116a1d86c5097cbaa0bd41e7 | pvsreenivas/BillingSoftware-SalesTax | /TaxCalc/ReceiptGenerate.py | 1,137 | 3.609375 | 4 | # 01a, 07Apr2021, SreenivasK, Initial code
from typing import List, Dict
from .TotalCalc import TotalCalc
class ReceiptGenerate:
def __init__(self):
self.product_list: List[str] = []
def receipt_generate(self):
"""
Returns:
None
"""
print("Ready to bill ... |
ba76365aa5bf69e54e4ee4cba9ebb4ef7c6daf97 | arehy/Elvenar | /tesztek/radioButton.py | 540 | 3.84375 | 4 | from tkinter import *
def sel():
selection = "You selected the option " + str(var.get())
label.config(text = selection)
root = Tk()
var = StringVar(root, '1')
R1 = Radiobutton(root, text="Kristály", variable=var, value='kristaly', command=sel)
R1.pack( anchor = W )
R2 = Radiobutton(root, text="Márvány", variab... |
792d0ff1f1bf339810b83c2b3f1c6f9aa637ea86 | sofiyuh/ProgramAssignments | /dictionarypractice.py | 855 | 3.578125 | 4 | groceries = {"chicken": "$1.59", "beef": "$1.99", "cheese": "$1.00", "milk": "$2.50"}
NBA_players = {"Lebron James": 23, "Kevin Durant": 35, "Stephen Curry": 30, "Damian Lillard": 0}
PHONE_numbers = {"Mom": 5102131197, "Dad": 5109088833, "Sophia": 5106939622}
shoes = {"Jordan 13": 1, "Yeezy": 8, "Foamposite": 10, "A... |
d59bd150cb4fcb379cb959b9310cf1204d06b65a | asolisn/Ejercicios-de-la-S9 | /class Ordenar.py | 440 | 3.59375 | 4 | class Ordenar
def__init__(self,lista):
self.lista=lista
def recorrerElemento(self):
for ele in self.lista:
print(ele)
def recorrerPosicion(self):
for pos,ele in self.lista.items():
print(pos,ele)
... |
d160a250d883ed92ce1b9effd217a4d5177b3bfc | FullStackToro/Python_Orden_por_Inserci-n | /main.py | 633 | 3.90625 | 4 |
#Los datos en el arreglo son ordenados de menor a mayor.
def ordenamientoPorInserccion(num):
#Recorre todas las posiciones del arreglo
for x in range (len(num)):
#No es necesario evaluar con un solo valor
if x==0:
pass
else:
#Comparación e intercambio (en caso de que el numero ubicad... |
acdd2bf6a695151004880dffae1d509918fb7b59 | jpcirqueira/Grafos1_Fofocando | /criagrafo.py | 514 | 3.953125 | 4 |
def main():
h = {}
numnos = int(input('digite o numero de pessoas:\n'))
for i in range(0,numnos):
vizinhos = []
nomeno = input('represente a pessoa por um nome ou numero ' + str(i) + ' :')
numvizinhos = int(input('digite o numero de conhecidos do ' + str(nomeno) + ' :' ))
... |
d4a3251bdf830118e2c04dd9cdff7c74ab1c1e1c | IanMK-1/Password-locker | /password_locker_test.py | 2,975 | 3.703125 | 4 | import unittest
from User import User
class TestPasswordLocker(unittest.TestCase):
def setUp(self) -> None:
"""Method that define instructions to be ran before each test method"""
self.new_locker_account = User("Ian", "Mwangi", "ianmk", "1234567")
def test_init(self):
"""Test to chec... |
419e9c5cbb652df0abccd13ca68273bc18327cd9 | jadugnap/python-problem-solving | /Task4-predict-telemarketers.py | 1,300 | 4.15625 | 4 | """
Read file into texts and calls.
It's ok if you don't understand how to read files.
text.csv columns: sending number (string), receiving number (string), message timestamp (string).
call.csv columns: calling number (string), receiving number (string), start timestamp (string), duration in seconds (string)
"""
impor... |
33a9b899adfee643bc01dfb05d9291fbec3d65c0 | JiahuanChen/homework2 | /simulator_v2.py | 10,991 | 3.5 | 4 | #! /usr/bin/python
"""
Try to finished all three extra tasks. I used Gaussian distribution for the
reason that it is the most common distribute in statistics.
"""
import sys
import math
import string
import random
from optparse import OptionParser
#add functions
parser = OptionParser()
parser.add_opt... |
a4b024fe5edf1f5da39078c8d52034ba303a98cc | schirrecker/Math | /Math with Python.py | 397 | 4.15625 | 4 | from fractions import Fraction
try:
a = Fraction(input("Enter a fraction: "))
b = Fraction(input("Enter another fraction: "))
except ValueError:
print ("You entered an invalid number")
except ZeroDivisionError:
print ("You can't divide by zero")
else:
print (a+b)
def is_factor (a, b):
... |
09772c3ab8555b1b1e33b480f7fb02dedc8dfacc | schirrecker/Math | /Censor text.py | 278 | 3.84375 | 4 | def censor(text, word):
list = text.split()
newlist = []
for w in list:
if w == word:
newlist.append(len(w)*"*")
else:
newlist.append(w)
return " ".join(newlist)
print (censor("Hi there Ismene", "Ismene"))
|
5ad4cf6a9e1acb0834dcb0d663d83e0db1417a46 | schirrecker/Math | /mathematical_functions.py | 109 | 3.546875 | 4 | def equation(a,b,c,d):
''' solves equations of the form ax + b = cx + d'''
return (d - b)/(a - c)
|
b105489d556e2941fa532c828bb47f8f19e4ea8d | hahapang/py_tutor | /Ch_11_TEST/names.py | 967 | 3.9375 | 4 | # Данная прога предназначена для проверки правильности работы функции
# get_formatted_name(), расположенной в файле name_function.py (Ex. 1).
# Данная функция строит полное имя и фамилию, разделив их пробелами и
# преобразуя первый символы слов в заглавные буквы.
# Проверка проводится путем импорта функции get_forma... |
258b95d7a40c7c62c7b195cc4fffd038e2ba0373 | hahapang/py_tutor | /magic_number.py | 320 | 3.703125 | 4 | # Аналогичнофайлу из предыдущего коммита.
# Условие answer (17) не равго 42. Так как условие
# истино - блок с отступом выполняется!
#
answer = 17
if answer != 42: #1
print("That is not correct answer.Please tre again!")
|
6aa4ee170811b133b8d66b3bc6ae6c87812412bf | christislord12/Panda3D-Project-Collection | /panda3dcgshaders/8.py | 8,642 | 3.5 | 4 | """
Like 0.py we restart from scratch and create a basic example with one point
light, that only supports diffuse lighting. There is no shader attached to this
example. If you do not understand this sample then open the Panda3D manual and
try to understand e.g. the Disco-Lights sample.
When we talk about lightin... |
618105d73f3df6c48f4760c14401e7ef202b66af | christislord12/Panda3D-Project-Collection | /panda3dcgshaders/2.py | 2,227 | 3.5 | 4 |
"""
The first useful sample. After this tutorial we are able to draw our cubes,
which look like cubes. With our knowledge we are not able to color them
correctly, but we can do some nice stuff and see the result. If everything is
black this time, something must be wrong.
"""
import sys
import direct.direct... |
0c07ac63e4e0c8bdb25ff27d3f18419705cc3506 | AnkitaPisal1510/list | /listmagic1.py | 746 | 3.625 | 4 | m=[
[8,3,4],
[1,5,9],
[6,7,2]
]
A=15
k=0
while k<len(m):
column=0
sum=0
l=len(m[k])
while column<l:
sum=sum+m[k][column]
column+=1
print(sum,"column")
x=sum+sum+sum
k+=1
print(x)
i=0
while i<len(m):
row=0
sum1=0
while row<len(m[i]):
sum1+=m[row... |
ee51b89083daa92736666f1712448406f4b118c3 | AnkitaPisal1510/list | /listdifference.py | 149 | 3.546875 | 4 | #difference
# l=[1,2,3,4,5,6]
# p=[2,3,1,0,6,7]
# i=0
# j=[]
# while i<len(p):
# if l[i] not in p:
# j.append(l[i])
# i+=1
# print(j) |
d9ebfa0746c3b2daf9bb4796bc910aaa34842e8a | AnkitaPisal1510/list | /listmagic.py | 713 | 3.5625 | 4 | #
#majic square
# a=[
# [8,3,8],
# [1,5,9],
# [6,7,2]
# ]
# row1=row2=row3=0,0,0
# col1=col2=col3=0,0,0
# dia1=dia2=0,0
# i=0
# b=len(a)
# while i<b:
# c=len(a[i])
# j=0
# while j<c:
# if i==0:
# row1=row1+a[i][j]
# col1=col+a[j][i]
# elif i==1:
# ... |
e085c19faf6fe9e11e547c31d30f02e8f29a9d4f | superxingzai/bhattacharyya-distance | /bhatta_dist.py | 4,095 | 3.75 | 4 | """
The function bhatta_dist() calculates the Bhattacharyya distance between two classes on a single feature.
The distance is positively correlated to the class separation of this feature. Four different methods are
provided for calculating the Bhattacharyya coefficient.
Created on 4/14/2018
Author: Eric... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.