blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
ec1ee8c046176956d28e9377c7963c531065714e
briansegs/narrow-valley
/narrow_valley.py
25,509
3.671875
4
import time import random # <--------------- Basic Functions ---------------> def coin_flip(): return random.choice(['heads', 'tails']) def die_roll(): return random.randint(1, 6) def time_print(string): # test_speed = .5 play_speed = 2 print(string) time.sleep(play_speed) def time_prin...
3b91717e1ba451ad21c386ccb593b4a1e1cd918f
shankarkrishnamurthy/problem-solving
/coinchange.py
2,179
3.53125
4
class Solution(object): def __init__(self): self.mall = -1 def coinChange1(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ def do_cc(c, a, anc): if a == 0: self.mall = min(self.mall, len(anc)) ...
983349baeefec6ecedc3f8c63e8c51fbc3983e18
AntonioCenteno/Miscelanea_002_Python
/Certámenes resueltos/Certamen 1 2014-2/pregunta3.py
4,305
3.625
4
#Las variables de control: #Numero de ticket num_ticket = 1 # Contadores de consultas de cada especialidad consultas_cardiologia = 0 consultas_internista = 0 consultas_oncologia = 0 consultas_neurologia = 0 # Duraciones de las consultas de cada especialidad duracion_cardio = 0 duracion_inter = 0 duracion_onco = 0 d...
7eff541cd38cd9420eda9c79882a8e44ab9a6a4f
tsupei/leetcode
/python/35.py
721
3.8125
4
class Solution(object): def binary_search(self, nums, target, offset): print(nums) if not nums: return offset mid = len(nums) // 2 if nums[mid] < target: return self.binary_search(nums[mid+1:], target, offset+mid+1) elif nums[mid] > target: ...
4059c6f18625b8042e7b0d75f0a27a9d182f1437
CarloSegat/finalYearProject
/loss.py
2,440
3.53125
4
import sklearn from keras import backend as K from keras.backend import categorical_crossentropy import tensorflow as tf def weighted_categorical_crossentropy(weights): """ A weighted version of keras.objectives.categorical_crossentropy This lets you apply a weight to unbalanced classes. Variables: ...
16cddb40c64193d6acb98c32701cd5194152296c
achoudh5/PythonBasics
/42.py
377
3.53125
4
import random from random import shuffle import zlib import sys import timeit import collections class Circle: def rec(self): list= [12, 24, 35, 24, 88, 120, 155, 88, 120, 155] b=[] print [b.append(i) for i in list if i not in b] print b def main(): l = Circle() # j=New...
0ca0ffaee2e6ee4a6846f98f36c4609c3f9772ec
aaditya-patil-0018/Excel-to-csv-converter
/main.py
690
3.90625
4
import pandas as pd import csv xlFileName = str(input('Enter name for Excel file : ')) try: xlFile = pd.read_excel(f"{xlFileName}.xls") except FileNotFoundError: print('Excel file not found!') quit() for i in xlFile: if 'Unnamed' in i: xlFile.drop(i, axis=True, inplace=True) rows = xlFile.sh...
7981882a342b6bf18bae32c748790689cdd45c3a
nicky-code/password
/credentials_test.py
3,443
3.828125
4
import unittest from credentials import Credentials import pyperclip class TestCredentials(unittest.TestCase): ''' Test class that defines test cases for the credentials class behaviours. Args: unittest.TestCase: TestCase class that helps in creating test cases ''' #Items up here.... ...
3c607d7022ea433924111f8a30b75ea5cd2463a3
vnallani259/VenkyPhython
/Python_Practice/math.py
400
3.828125
4
from math import sqrt, sin, cos, pi p_x = 100 p_y = 0 radians = 10 * pi/180 COS10 = cos(radians) SIN10 = sin(radians) x, y = eval(input("Enter initial satellite coordinates (x,y):")) d1 = sqrt((p_x - x)*(p_x - x) + (p_y - y)*(p_y - y)) x_old = x; x = x*COS10 - y*SIN10 y = x_old*SIN10 + y*COS10 d2 = sqrt((p_x - x)*(p_x...
9f0c93f4c290be09b1c516d68759ffbe62db18ca
ynjacobs/Object-Oriented-Programming-Bank-Account
/exercise1.py
1,247
3.890625
4
class BankAccount: def __init__(self, balance, interest_rate): self.balance = balance self.interest_rate = interest_rate def __str__(self): return "your balance is {} and the interest rate is {}".format(self.balance, self.interest_rate) def deposit(self, amount): self....
b10f079d25c59094ddbdeb1f4f5cfc3c80442c6d
ramkishorem/pythonic
/session5_function_module/01.py
1,131
4.71875
5
""" Functions: The buildup Remember this part of code that we used at various places for key,value in details.items(): print('{:20}: {:20}'.format(key.title(),str(value))) We used this to print info inside a dictionary in a pretty form. It is quite a complex-looking code. Ideally, we would like to do s...
d7023c5e739eb28501a6e3adec254f455296e2a7
crudalex/microsoft-r
/leetcode/sortList.py
1,677
3.703125
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): """ :rtype: ListNode :type x: int """ self.val = x self.next = None def add(self, x): """ :type x: int """ if self.val is None: self.val = x ...
3095c1b1b8b847cf59213b5bf86c196c2ebbbe63
JsRicardo/python-study
/basepy/numpy/juzhen.py
756
3.5
4
# -*- coding: utf-8 -*- import numpy as np mat = np.mat('1,2,3; 4,5,6') #传入字符串 用分号隔开,代表一个数组,生成一个矩阵 re = mat.reshape(2, 3) #将原数组的数字按照原来的顺序,重新生成一个2 * 3 的矩阵 mat.shape n=mat.T # 转置 将原矩阵的轴进行旋转 n.shape # 矩阵乘法 # 一个 3 * 2 的矩阵 和一个 2 * 3的矩阵相乘 # mat的第一行和n的每一列对应位置的数相乘在相加 生成结果的第一行 # mat的第二行和n的每一列对应位置的数相乘在相加 生成结果的第二行 mat * n ...
9b14cff8043e9cfea63afee05fa857247853a4a7
miyahara1005/miyahara1005_day02
/sample09.py
242
3.546875
4
# if と for の組み合わせ # 60点以上なら合格、60点未満なら不合格としたい scores = [33, 70, 99, 10] for score in scores: if score >= 60: print('合格') if score <= 60: print('不合格')
8321994023bbe8623ef1a3984d6b2efe4a1f5244
thecodearrow/LeetCode-Python-Solutions
/Set Matrix Zeroes.py
1,102
3.5
4
#https://leetcode.com/problems/set-matrix-zeroes/submissions/ class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: #Lazy Propagation Approach! (without extra space!) N=len(matrix) if(N==0): return first_row=False first_col=False M...
5383c81617ff97f59acabb1e94ddc27f6d64f9d7
alexandraback/datacollection
/solutions_5634697451274240_1/Python/Astrae/QualifB.py
3,423
3.5
4
# -*- coding: utf-8 -*- """ Created on Sat Apr 09 05:16:47 2016 @author: Fred """ def qualifB(L): # On va tenter cette strat : # si ya que des + : fini # sinon : #si la liste commence par un -, on parcourt la liste jusqu'au dernier - et on #flip jusque là (c...
0f263f51c9bc27a0b900a28194eb2952252720d2
EthanLaurenceau89/Final_Project
/SFCrimeProjectCode.py
9,671
3.859375
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') CrimeData = pd.read_csv("SFCD_2018.csv") def CrimeFunc(data): ## Function that will take in crime dataset. return data.head() ## Use head c...
25d3669cc518724dbc163587b3cb803f897c3e0a
he-is-james/Algorithmic-Toolbox
/Week 1 Programming Challenges/sum_of_two_digits.py
180
4
4
# python3 def sum_of_two_digits(first_digit, second_digit): return first_digit + second_digit num = input() a, b = map(int, num.split()) print(sum_of_two_digits(a, b))
0d1c7a6f78ba84a3e7197a77fd89eab68d767d00
Yukikazari/kyoupuro
/.提出一覧/AtCoder/abc186/c/main.py
484
3.640625
4
#!/usr/bin/env python3 #import #import math #import numpy as np N = int(input()) ans = 0 def ten(num): isok = True while num > 0: if num % 10 == 7: isok = False break num //= 10 return isok def eight(num): isok = True while num > 0: if num % 8 == ...
75b0c5722b4d15397f13865cbb8ff6be28721edc
Tikrong/sudoku
/sudoku.py
6,784
3.546875
4
""" high level support for doing this and that. """ import copy class Variable(): """ create new variable with coordinates """ def __init__(self, y, x): self.x = x self.y = y # define hashing of variable to use it as key in dicts and store them in sets def __hash__(self):...
3e2dabd91c825b908879d4cb97cbe5f5209e34bd
Kumarved123/Basic-Data-Structure-Algorithm
/Graph and priority Queue/N_Queen_problem.py
692
3.65625
4
''' The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other. For example, following is a solution for 4 Queen problem.''' N = 6 col = [i for i in range(N)] def is_safe(arr): n = len(arr) for i in range(n): for j in range(i+1,n): val1 ...
ef568050e0bd950e308679080ea65dada022e612
Roboyantriki-SNU/Python_Workshop
/python basics/pro3.py
271
3.828125
4
while True: print('Enter the username') username = input() if (username != 'Alex'): continue print('Enter the password') pws = input() if (pws == 'dog'): break; else: print('Access not granted') print('Access granted')
90ce8053afd00b0f547c1ddfd8be5537826271da
SongofG/Python_Basics
/Boolean Q1.py
165
3.9375
4
## Q1) def main(): num = input("type any number: ") if num.isdigit(): print(int(num)**2) else: print("This is not an integer.") main()
4d24e355bed69730c25202d490fdf4cc5d3a9c0b
Vovanuch/python-basics-1
/happy_pythoning_cource/Part_13/13.1.1.Print_square/13.1.1.Print_square.py
773
3.890625
4
''' Звездный прямоугольник 1 Напишите функцию draw_box(), которая выводит звездный прямоугольник с размерами 14×1014 \times 1014×10 в соответствии с образцом: ********** * * * * * * * * * * * * * * * * * * * * * * * * ********** При...
4f6e07c58ae3ce5b8bf7927778fe2e13dad3c4c4
yidao620c/core-algorithm
/algorithms/c01_linear/linkedlist/linked_list_double_cycle.py
1,524
3.640625
4
# -*- encoding: utf-8 -*- """ 双向循环链表数据结构 """ from algorithms.c01_linear import NodeDouble class LinkedListDouble: """ 双向循环链表,带哨兵 """ def __init__(self): head = NodeDouble(None) head.pre = head.next = head # 将pre和next都指向自己 self.head = head def insert_node(self, node, new_...
d42e3efe4af61c29771da12a3fff3b7cdbe17819
xkoma007/leetcode
/080RemoveDuplicatesfromSortedArrayII.py
650
3.578125
4
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ m_len = len(nums) total_len = m_len repeat_num, repeat_val = 0, 0 for i in range(m_len-1, -1, -1): if repeat_num == 0 or nums[i] != repeat_...
bd9e4d75f9bf2c5c0d022841c44bc3b760bf7292
allenpark/1412finalproject
/pairsPlayer.py
1,835
3.875
4
class PairsPlayer: def __init__(self, pid): self.type = "Default Player" self.pid = pid self.hand = [] self.score = 0 self.scored = [] def insert_into_hand(self, cards): new_cards = [x for x in cards] new_hand = [] while len(self.hand) > 0 or len(...
33070dab541d884a2f5e3839a53037fb3f1de8ea
Ashanthe/van-input-naar-output
/feestlunch.py
603
3.671875
4
croissantjes = input("hoeveel croissants :") prijsC = 0.39 stokbrood = input("hoveel stokbroden :") prijsS = 2.78 kortingsbonnen = input("hoveel kortngsbonnen :") korting = 0.50 #Prijs print(int(croissantjes) * prijsC + int(stokbrood) * prijsS - int(kortingsbonnen) * korting) prijs = (int(croissantjes) * pr...
9c3d7acad8c4010fca3b22fcd4498b735552b6fd
suman2020/AlgorithmPractice
/linkedlist.py
7,260
4.0625
4
# listA = [1,2,3,4,5,6,7,8] # # class Node: # def __init__(self, currentVal = None , cNodeNext = None): # self.currentVal = currentVal # self.cNodeNext = cNodeNext # head = Node(listA[0]) # #1->None # # for value in listA[1:]: # newNode = Node(value) # currentNode = head # while currentN...
753ed082cab938301ff87d93c7e21b2a705e2df9
JJong-Min/Baekjoon-Online-Judge-Algorithm
/Data Structure(자료구조)/Data_Structure_9번.py
573
3.546875
4
#리스트가 아닌 딕셔너리 활용, 시간초과x n = input() res = dict() for _ in range(int(n)): per, stat = input().split(" ") res[per] = stat for i in sorted(res.keys(), reverse=True): if res[i] == "enter": print(i) # python3로는 시간초과, pypy3로는 통과 import sys n = int(sys.stdin.readline()) person = [] for i in range(n): name, ...
e4acb495a5f4a4cefc198d4af15b8772537c5b1c
lim1202/LeetCode
/Algorithm/sort.py
3,182
4.0625
4
"""Sort""" import random import time def bubble_sort(nums): """Bubble Sort""" if not nums: return None for i in range(len(nums)): flag = False for j in range(len(nums) - i - 1): if nums[j] > nums[j+1]: nums[j], nums[j+1] = nums[j+1], nums[j] ...
5626346665b7ecb12d4dc2604405330acd546933
rparthas/Repository
/Python/bfs.py
959
3.75
4
graph = {"cab": ["cat", "car"], "mat": ["bat"], "cat": ["mat", "bat"], "car": ["cat", "bar"]} visited_nodes = {} def get_neighbours(vertex): vertices = [] if vertex in graph: for node in graph[vertex]: vertices.append({node: vertex}) return vertices def print_path(dest): path = [...
564731e7d16b04ac19bd346a1fad56d81a5618f7
NickyJay/PortfolioProject
/week3/using_sets.py
501
3.78125
4
# numbers_set = {1, 2, 3, 4, 4} #duplicate values removed #numbers_set = {1, 2, 3, 4, [5, 6]} # cannot use mutable data types # numbers_set = {1, 2, 3, 4, (5, 6)} #tuples are imutable, OK to use! # print(numbers_set) words_set = {"Alpha", "Bravo", "Charlie"} # abcd = "" # for word in words_set: # abcd += word # p...
aee80b42410f25dbe7c46c6912afa83610936ce5
jperla/webify
/webify/templates/helpers/time.py
1,289
3.703125
4
import datetime def fuzzy_time_diff(begin, end=None): """ Returns a humanized string representing time difference between now() and the input timestamp. The output rounds up to days, hours, minutes, or seconds. 4 days 5 hours returns "4 days" 0 days 4 hours 3 minutes returns "4 hours", etc...
5cbc199946d914dfe1ef81a47f3e06b88b2f4717
BaluAnush18/Machine-Learning-Basics
/linearregression1.py
1,396
4.375
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt #REGRESSION IS TO PREDICT A REAL CONTINUOUS REAL VALUE. #CLASSIFICATION IS TO PREDICT A CATEGORY OR A CLASS. dataset = pd.read_csv('Salary_Data.csv') x = dataset.iloc[:, :-1] y = dataset.iloc[:, -1] from sklearn.model_selection import ...
96e9f6576fe030615de3dfb84af1f2f16d801db3
rutvik2611/hw
/Task5/q3.py
221
3.53125
4
k = int(input("Enter 4 digit number: ")) convert = str(k) l = len(convert) while l != 4: try: k = input("TOO LONG OR SHORT , Try AGAIN ") l = len(k) except ValueError: print("Value Error")
c84257d1ec1572f050b3e8a4afe1eafee60d474f
fredericaltorres/fCircuitPython
/boot.py
822
3.5625
4
""" https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage """ import board import digitalio import storage # # See output in file boot_out.txt # print('boot.py - start') # For Gemma M0, Trinket M0, Metro M0/M4 Express, ItsyBitsy M0/M4 Express # switch = digitalio.DigitalInOut(board.D2) switch...
9550da088684c38db8e5e0b98d75d047d3b57418
cogito0823/learningPython
/data_structures/binary_tree/binary_tree.py
2,456
3.9375
4
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- ''' @File : binary_tree.py @Time : 2020/03/17 11:40:06 @Author : cogito0823 @Contact : 754032908@qq.com @Desc : 递归生成二叉树、遍历二叉树(层次遍历使用队列) ''' import queue class Node(): """节点类""" def __init__(self,data): self.data = data self....
7eae6bb0c01918f6661269b3bfb8e051c7fcc5fc
AprilCat/learnPython
/basicPractice/day009_salary.py
1,239
3.6875
4
from abc import ABCMeta, abstractmethod class Employee(object, metaclass=ABCMeta): def __init__(self, name): self._name = name @property def name(self): return self._name @abstractmethod def get_salary(self): pass class Programmer(Employee): def __init__(self, name):...
fcc5e539904815776e44748be99d608e07826d19
enriquezc/DialogComps
/src/Dialog_Manager/Student.py
1,670
3.625
4
from src.Dialog_Manager import Course '''Student object Basically stores all our information about the student There's some info we don't use, but could be used in the future Variable names are self explanitory. ''' class Student: def __init__(self): self.name = None self.current_classes = [] ...
115f758f7077d77f8694f14ffaceac683b73af96
GolamRabbani20/PYTHON-A2Z
/DYNAMIC_PROGRAMMING/SumOfnNumbers.py
92
3.734375
4
def Sum(n): if n == 0: return 0 return n + Sum(n-1) print(Sum(int(input())))
a7b13c6a216db18949fe11b30c298f330678a7d6
Hamsike2021/Practice_6
/5.py
146
3.890625
4
def is_sorted(t): if sorted(t) == t: return True return False print(is_sorted([1, 2, 3])) # example print(is_sorted([3, 1, 2])) # example
c9c254513f4041b5a5d639a78e643e234dc2ef80
Raphaelshoty/Python-Studies
/tryCatch.py
556
3.78125
4
try : print("teste de try") print("Im "+30+"Years old") except TypeError as t: print("Não se faz conversões implícitas de tipo ", str(t)) log = str(t) saveLog = open("logDeErro.txt","w") saveLog.write(log) saveLog.close() except Exception as e: print("Deu ruim meu caro sabe porque ? ...
5f1850205cc8305428d1d209f5953f65af3950fe
juliasgan/tennis_tracker
/game.py
1,094
3.78125
4
class Game(object): '''game represents the tennis game with two teams and a winner''' '''game also represents the individual games(made up of at least 4 points) that add up to a set''' '''0, 15, 30, 40, Deuce, Advantage-In, Advantage-Out, Winner_of_game''' def __init__(self, teamA, teamB, teamA_score,...
91fef5f286db8ddeb0384e79112e3e626f231e44
sundaygeek/book-python-data-minning
/code/3/3-1.py
612
3.6875
4
# -*- coding:utf-8 -*- # 匿名函数 from math import log #引入Python数学库的对数函数 # 此函数用于返回一个以base为底的匿名对数函数 def make_logarithmic_function(base): return lambda x:log(x,base) # 创建了一个以3为底的匿名对数函数,并赋值给了My_LF My_LF = make_logarithmic_function(3) # 使用My_LF调用匿名函数,参数只需要真数即可,底数已设置为3。而使用log()函数需要 # 同时指定真数和对数。如果我们每次都是求以3为...
a58ce091a4b8db1d861328e4efcf9ac4bbf826f1
nanako-chung/python-beginner
/Assignment 3/ChungNanako_assign3_problem3.py
4,564
4
4
#Nanako Chung (worked with Anusha Chintalapati) #September 29th, 2016 #M/W Intro to Comp Programming #Problem #3: Birthday Analyzer #ask user for start and birth date print("Instructions: Enter the start date and birthdate for an employee to determine their age at the start of employment.") start_date=int(input...
d27af657c0e430a6d44c417c71a95d812620de9f
zhaocanhs/Python
/Day05/xmltest.py
1,523
3.921875
4
# -*- coding:utf-8 -*- # 作者:火小森 # 日期: 20/1/21- 17:44 # 当前用户名: zc # 文件名:xml ''' # xml协议在各个语言里的都 是支持的,在python中可以用以下模块操作xml    import xml.etree.ElementTree as ET tree = ET.parse("xml_test.xml") root = tree.getroot() print(root.tag) # 遍历xml文档 for child in root: print(child.tag, child.attrib) for i in child: print(i....
b9ac3fa10d601aaad4e132f0d87e40398099a28c
jamesawgodwin/PythonMachineLearningTemplates
/Random_walk_game.py
1,282
4.3125
4
# -*- coding: utf-8 -*- """ game that determines probability that you will reach height of 60 steps given steps taken by roll of dice and clumsinesss. Start at 0 height and roll dice 100 times, simulate 10000 times. Display results. Calculate probability of reaching height of 60 steps """ import matplotlib.pyplot as p...
0b12999a31b6cc1b51a7f40429bf64934927b682
XinyuYun/cs1026-labs
/lesson9/task3/task.py
664
4.15625
4
# Replace the placeholders with code and run the Python program sentence ="I had such a horrible day. It was awful, so bad, sigh. It could not have been worse but actually though "\ +"such a terrible horrible awful bad day." makeItHappy ={"horrible":"amazing","bad":"good","awful":"awesome","worse":"better",...
1420151b7383bcda68349d53fa36d1a98c812945
HaymanLiron/46_python_exercises
/q16.py
250
3.625
4
def filter_long_words(list_of_words, n): # takes in a list_of_words and returns all words in list longer than n characters output = [] for word in list_of_words: if len(word) > n: output.append(word) return output
fdc782952b80f9e3df104cd69a5810e3c16226f6
aoyerinde/python-learning
/Histogram Plotting.py
1,391
3.703125
4
#building histoograms on just python a = (0,1,1,1,2,3,7,7,23) def count_elements(seq) -> dict: """""Tally elements from `seq`""" hist = {} for i in seq: hist[i] = hist.get(i,0) + 1 return hist #count the number of each element in the sequence counted = count_elements(a) from collecti...
4423358617f7ef096e8fe16d3e5f6618bb041645
fonsidols/librarySlod
/asignaturas.py
447
3.828125
4
# encoding: utf-8 print("Asignaturas optativas Agno 2017") print("Asignaturas optativas: Informatica grafica - Pruebas de software - Usabilidad y accesibilidad") opcion=input("Escribe la asignatura escogida ") asignatura=opcion.lower(); if asignatura in ("informatica grafica", "pruebas de software", "usabilidad y a...
06f9e58d24b7022955f98583e4c53f5b20c742f3
MariaSyed/Python-SelfStudy
/Chapter 2/2.6 String slices.py
246
4.03125
4
# -*- coding: cp1252 -*- string = "desserts" stringA = string[0:4] stringB = string[-4:] stringC = string[::-1] print("The first 4 characters were:",stringA) print("The last 4 characters were:",stringB) print("The string backwards was:",stringC)
5f2479f70eddab4b40b6ddc9b464111df0abb2ad
chati757/python-learning-space
/lambda/lambda_filter.py
244
3.8125
4
number_list = range(-5, 5) less_than_zero = list(filter(lambda x: x < 0, number_list)) print(less_than_zero) # Output: [-5, -4, -3, -2, -1] #use list comprehensions instread of using lambda and filter print([i for i in number_list if i < 0])
1035073f319d003e3a9045b6acd7a167f415ab3b
lightbits/euler
/problem87.py
1,177
3.546875
4
# The smallest number expressible as the sum of a prime square, prime cube, # and prime fourth power is 28. In fact, there are exactly four numbers below # fifty that can be expressed in such a way: # 28 = 2^2 + 2^3 + 2^4 # 33 = 3^2 + 2^3 + 2^4 # 49 = 5^2 + 2^3 + 2^4 # 47 = 2^2 + 3^3 + 2^4 # How many numbers below ...
9db60664676082b5ba7ad0bc21152352707b37ce
julianascimentosantos/cursoemvideo-python3
/Desafios/Desafio044.py
915
3.78125
4
print('{:=^40}'.format('LOJAS NASCIMENTO')) preço = float(input('Preço das compras R$')) print('''Condições de pagamento: [ 1 ] À VISTA DINHEIRO OU CHEQUE [ 2 ] À VISTA CARTÃO [ 3 ] DIVIDIDO EM ATÉ 2X NO CARTÃO [ 4 ] DIVIDIDO EM 3X OU MAIS NO CARTÃO''') condição = int(input('Qual é a opção:' )) if condição == 1: v...
7da094ebb31eababce7dd99a2f6ae4a0bbb75b49
hqs2212586/startMyPython3.0
/第五章-面向对象/5 属性查找.py
1,891
3.734375
4
class LuffyStudent: school = 'luffycity' def __init__(self, name, sex, age): # 实例化时自动调用 self.Name = name self.Sex = sex self.Age = age def learn(self): print('%s is learning' % self.Name) def eat(self): print('%s is sleeping' % self.Name) # 产生对象 stu1 = Luffy...
382a417bdaf7a8fbb33e33ffa687c1cb21abb3b1
BondiAnalytics/Python-Course-Labs
/09_exceptions/09_05_check_for_ints.py
453
4.46875
4
''' Create a script that asks a user to input an integer, checks for the validity of the input type, and displays a message depending on whether the input was an integer or not. The script should keep prompting the user until they enter an integer. ''' try: nmbr = int(input("Enter a number: ", )) except ValueErr...
5523c76b6c498a2a24e6e4a7d6b2a0cf44715e55
lihaineng/little-projects
/plane_war/map.py
824
3.515625
4
""" 因为地图要移动所以有属性有方法因而将地图看做一个类 """ import pygame import random WIN_X = 512 WIN_Y = 768 class Map(object): def __init__(self, win): pygame.init() self.window = win self.num = random.randint(1, 5) # 通过随机数产生不一样的地图背景 self.img = pygame.image.load("res/img_bg_level_%s.jpg" % self.num...
db9792f1aaf271cf86e3046265f66123fa022ddc
varun2784/python
/qsort.py
1,039
3.859375
4
import random def qsort_python(keys): if not keys: return [] rindex = random.randint(0, len(keys)-1) pivot = [keys[rindex]] less = [x for x in keys if x < keys[rindex]] more = [x for x in keys if x > keys[rindex]] return less + pivot + more def qsort(keys): if not keys: ret...
dae356181670e4ee363e585ac584c81f454dede2
shenyiting2018/price-of-chair
/src/app.py
717
3.515625
4
import requests from bs4 import BeautifulSoup request = requests.get("https://www.johnlewis.com/john-lewis-partners-miami-garden-dining-chair-grey/p3711083") content = request.content soup = BeautifulSoup(content, "html.parser") element = soup.find("p", {"class": "price price--large"}) string_price = (element.text.st...
ac1740688364f5609e9d4535a7196305f8e693ff
jamdoran/euan
/Sess001/euan003.py
229
3.75
4
def addup(a,b): return a + b def minus(a,b): return a - b # print (addup(1,1)) # print (minus(10,5)) # Loop for x in range(1,10000000) : print (x) # x = 0 # while x < 12345: # print (x) # x = x + 1
a1e1b88291179a5584a15459ec2e96bb13358f59
gabriel-cf/davil
/mymodule/src/backend/algorithms/normalization/standardized_normalization.py
1,284
3.546875
4
""" Standardized """ from __future__ import division from ...util.df_matrix_utils import DFMatrixUtils STANDARDIZED_ID = "Standardized" def standardized(df, df_level=False): """ Will normalize the DataFrame according to their mean and standard deviation. This makes the normalized values to ha...
bda95acfc9faabd6c8f556fa3dfb32711ded2e8b
voidrank/pythonLearning
/src/t64.py
259
3.53125
4
def flatten(nested): try: try: nested + '' except TypeError: pass else: raise TypeError for i in nested: for j in flatten(i): yield j except TypeError: yield nested nested = ['1123',[1,2,1],[[1,2],1],1] print list(flatten(nested))
22165b652570141a9e9bc16809fe9c395c5f232c
aussio/starveio-bot
/circle.py
977
3.671875
4
import pyautogui import math import sys from time import sleep, time def move_mouse_in_circle(radius, steps, duration=1): distance = (math.pi * 2 * radius) / steps step_duration = duration / steps # generate 360 decimal coordiantes for a circle'ish shape mouse movement for i in range(0,steps): # G...
df9bfbf7daab7c74164b9ccc3ac092027de19999
Rubenoo/Python
/Les4/1. Catching exceptions.py
724
3.546875
4
hotelKosten = 4356 def programma(): while True: try: aantalPersonen = int(input('Hoeveel mensen gingen er mee?: ')) if aantalPersonen < 0: raise Exception elif aantalPersonen == 0: raise ZeroDivisionError else: b...
bce81b89a51494eb8db90f856dc479f4916eeb9f
zqhhn/Python
/day02/code/variable.py
210
3.953125
4
""" 使用input()输入 """ name = input("请输入您的姓名:") print("Hello,",name) year = int(input("请输入年份:")) is_leap = (year % 4 == 0 and year % 100 !=0 or year % 400 == 0) print(is_leap)
a52a3394c353f0aa07726247a154c40972d52766
Ichbini-bot/python-labs
/03_more_datatypes/2_lists/03_06_product_largest.py
631
4.40625
4
''' Take in 10 numbers from the user. Place the numbers in a list. Find the largest number in the list. Print the results. CHALLENGE: Calculate the product of all of the numbers in the list. (you will need to use "looping" - a concept common to list operations that we haven't looked at yet. See if you can figure it ou...
f029cff8ddb7e844b493dffdc0568fb9856953d8
ydang5/Assignment-1
/A1_T2.PY
119
3.578125
4
humidity = 20 if humidity < 30: print("Dry") elif humidity > 60: print("High Humidity") else: print("Ok")
ee5fb6ef601321b670238b0c409ffd0916c07a8b
hugo-paiva/curso_Python_em_Video
/Exercícios Resolvidos/aula07a.py
477
3.8125
4
sair = False while sair == False: print('='*15+' DESAFIO 13 '+'='*15) l = float(input('Qual é a largura da parede em metros? ')) h = float(input('Qual é a altura da parede em metros? ')) a = h*l # Cada litro de tinta pinta um área de 2m² t = a/2 print('Para pintar uma parede de {} metros qu...
13979bc36eda56037d981c8724576dc7b10b6db5
ALREstevam/Curso-de-Python-e-Programacao-com-Python
/Resolução de problemas II/ListasTuplasDeicionários.py
3,982
4.21875
4
''' Arrays são chamados de sequências Tipos String s = 'texto' Lista São elementos mútáveis Podem ter elementos de diferentes tipos l = ['asa', 1] Tupla t = (1, 2, 3) Tuplas e strings não são mutáveis Mapping (relacionam chave ao valor) Acesso Com números po...
95ee2e1164e36d1db221e4ba1377b14fd28ba926
pounders82/rock-paper-scissor
/rock-paper-scissors.py
673
3.984375
4
import random print('...rock....') print('...paper...') print('...scissors...') e = True while e == True: a = ['rock', 'paper', 'scissors'] b = input("Please enter a choice: ").lower() c = random.choice(a) if b in a: if (b == 'rock' and c == 'scissors') or (b == 'scissors' and c == 'paper') or (b == 'paper' an...
952a6382a34432f15eccc379acb8abab11023a4e
JohnnyYamanaka/Uri_challenge_python
/1924.py
135
3.890625
4
qty_course = int(input()) courses = [] for course in range(0, qty_course): courses.append(input()) print("Ciencia da Computacao")
eb474a5b9cea520da10b4ebc5f90675794ae9d44
Emmalindal/MAT-IN1105
/uke 2/f2c_table_while.py
638
3.828125
4
#Exercise 2.1: Make a Fahrenheit-Celsius conversion table #F = [] #C = F - 32*(5/9) F = 0 steps = 10 while F <= 100: C = F-(32*(5/9)) #print with 6 digits in total, 2 decimals: print('Fahrenheit %.2f Celsius %.2f' %(F,C)) F = F + steps """ Terminal> Python f2c_table_while.py Fahrenheit 0.00 Celsius -17...
0829af3fd85597f382c87801781b14fa50302a5d
rafaelperazzo/programacao-web
/moodledata/vpl_data/87/usersdata/228/53539/submittedfiles/contido.py
332
3.703125
4
# -*- coding: utf-8 -*- n=int(input('digite o numero de elementos de a:')) m=int(input('digite o numero de elementos de b:')) listaa=[] listab=[] for i in range (0,n,1): elea=int(input('digite o elemento:')) listaa.append(elea) for i in range(0,m,1): eleb=int(input('digite o elemento:')) listab.append(...
be9c9db9862b5a5dd6e5609f57d89a46a0268437
mastja/pythonSockets_clientServerChat
/server.py
2,369
3.53125
4
# Project 4 - Server and Client Chat Program - server file # Programmer - Jacob Mast # Date 8/5/2020 # Description - Simple client-server program using python sockets. Program emulates a simple chat server. # source. 1 - https://www.binarytides.com/python-socket-programming-tutorial/ # source. 2 - https://realpyt...
56d1fb239d0d371ebc47353ffbf6c38fe7dd5f99
IfDougelseSa/cursoPython
/exercicios_secao5/2.py
143
3.96875
4
# raiz quadrada import math x = float(input("Digite o número: ")) if x >= 0: print(math.sqrt(x)) else: print("Número inválido!!")
a2f3ba6e7e83b66334b0b5d7e7bf0f8f8d90e1c4
bhumilad/full-python-
/oops10.py
911
4.1875
4
# abstract method # # from abc import ABC , abstractmethod # # class Shape(ABC): # @abstractmethod # def area(self): # return 0 # # class Rect(Shape): # type="rectangle" # sides=4 # # def __init__(self): # self.length='5' # self.breadth='10' # # def area(...
3d3bf7958416a414b4e141f8e2405a9f3466202f
mymorkkis/chess-python
/src/game_errors.py
1,460
4.125
4
"""User defined exceptions for chess game. Exceptions: NotOnBoardError: Passed coordinates not on game board PieceNotFoundError: No piece located at from coordinates InvalidMoveError: Invalid move attempted """ class Error(Exception): """Base class for exceptions in this module."...
0774dd1c0d17f4f43d9fedfe7774c607961bc63c
sandrabee/Udacity_CS101
/Unit7/list_explosion.py
604
3.96875
4
#List Explosion #Define a procedure, explode_list, that takes as inputs a list and a number, n. #It should return a list which contains each of the elements of the input list, #in the original order, but repeated n times. def explode_list(p,n): l = [] count = n while count > 0: for i in range(len...
288e5bff74c0533399d4ef4ae0b0929da21f2b83
manikandanmass-007/manikandanmass
/Python Programs/program to covert celcius to fahrenheit.py
169
4.25
4
#program to covert celcius to fahrenheit cel=(int(input("entetr the celcius value:"))) fahren=(1.8* cel)+32 print ("the fahrenheit value of",cel,"celcius is:",fahren)
d6cb545d608c82a3d9dc3d7efbd296a54633daaa
chuyuanli/RR-mix-product-polarity-detection-
/RawData/json_txt.py
3,745
3.5625
4
import json import os def pre_processing(rawString): """pre-processing: delect strings like '\x92', normalize words""" # 1.eliminate the space at the begining if rawString.startswith(" "): rawString = rawString[1:] # change to lower-case rawString = rawString.lower() # 2.unicodes to ...
633321378c874830b1801188878bfb27d524768f
nsinghai/FST-M1
/python/Activity6.py
168
4.125
4
# Activity:6 - Pattern Generator # Write a Python program to construct the following pattern, using a nested loop number. for i in range(10): print(str(i) * i)
203d5e271c8a80d70cf5404716b0703c1a726ad7
suleymankhrmn/python-assignment
/Assignment-1(if-Statements).py
396
4.09375
4
userInfo = { "Suleyman" : "123", "Joseph" : "ujk" } checkValue = False entryUsername = input("Please enter your username: ") for value in userInfo: if(value == entryUsername): checkValue = True if(checkValue): print("Hello " + entryUsername + " your password " + userInfo[ent...
ef7bc6baebe9da661971f875426bd9c46b2b41b0
Youbornforme/Python9.HW
/hw6.sizes.py
879
3.640625
4
sizes = { 'XXS': {'Russia': 42, 'Germany': 36, 'USA': 8, 'France': 38, 'UK': 24}, 'XS': {'Russia': 44, 'Germany': 38, 'USA': 10, 'France': 40, 'UK': 26}, 'S': {'Russia': 46, 'Germany': 40, 'USA': 12, 'France': 42, 'UK': 28}, 'M': {'Russia': 48, 'Germany': 42, 'USA': 14, 'France': 44, 'UK': 30}, 'L':...
0aa1ad385f6a99ccfe1a55073e1350a6863493d6
urmilasalke/python-Program
/basic/ifel.py
80
3.578125
4
a=10 b=20 if a>b: print("a largest") elif a<b: print("b largest")
f8d7edb02e9ad2cd011822964fb05a42fe1c53c7
betty29/code-1
/recipes/Python/580613_Generate_set_random/recipe-580613.py
315
4
4
"""Generate a set of random numbers based on the number requested.""" import random try: numbers = input("How many numbers do you want generated? ") for num in range(int(random.random() + 1), int(numbers) + 1): print(random.randint(num, num * 10)) except ValueError: print("Input is invalid!")
70d6035e7a673046255dc03d1b1ca37366940a55
dusgn/sparta_algorithm
/week_1/homework/01_find_prime_list_number.py
1,876
4
4
# input = 4 # # # def find_prime_list_under_number(number): # prime_num = list() # if number < 2: # return [number] # for num in range(2, number+1): # if num == 2 or num == 3 or num == 5: # prime_num.append(num) # continue # elif num % 2 == 0 or num % 3 == 0 o...
6fa5bc72d4af8243be44a19cae1af9843f0c199d
enricodangelo/exercises-in-style
/python/coursera_python_spec/4.6-assignement.py
1,172
4.4375
4
# 4.6 Write a program to prompt the user for hours and rate per hour using # raw_input to compute gross pay. Award time-and-a-half for the hourly rate for # all hours worked above 40 hours. Put the logic to do the computation of # time-and-a-half in a function called computepay() and use the function to do the # comput...
b92b9e302493bb68a4d3f2a10651add0330074bd
0x0400/LeetCode
/p234.py
768
3.90625
4
# https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ from common.tree import TreeNode # # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def lowestCommonAnce...
888e28eceee3f05bc97fa5ec671050c57ac60ffa
oliveirajonathas/python_estudos
/pacote-download/pythonProject/cursoguanabara/aula19.1.py
309
4
4
brasil = [] estado1 = {'uf': 'Rio de Janeiro', 'sigla':'RJ'} estado2 = {'uf':'São Paulo', 'sigla': 'SP'} brasil.append(estado1) brasil.append(estado2) print(f'Dicionário estado1: {estado1}') print(f'Dicionário estado2: {estado2}') print(f'Lista: {brasil}') print(brasil[0]['uf']) print(brasil[1]['sigla'])
da31fc1b47505f00e2a4cce99baa37b2d50c91d6
creatoryoon/CSE2003_1_2021_1_Sogang_-
/실습/제출/[실습12-2]120210198_윤동성_3.py
227
4.21875
4
def trans(): global s for i in range(3): print("***original string: %s ***##" %s, end="") s = "The string printed out!" print(s) return s s = input("Enter the string: ") trans() print(s)
bb1e866796e893b17e694efe7b956e2d216cdaba
groodt/project-euler
/1/problem1.py
203
3.75
4
#!/usr/bin/python if __name__ == '__main__': multiples_of_3_or_5 = [i for i in range(1,1000) if (i % 3 == 0 or i % 5 == 0)] sum = 0 for i in multiples_of_3_or_5: sum+=i print sum
5ee1ecbd0c7545ccc93b49c3312d271f7860330e
omatveyuk/interview
/CodeFights/matrix_elements_sum.py
1,349
4.28125
4
""" Find sum of matrix elements. Input a rectangular matrix, each cell containing an integer. Some cells are 0. That is why any cell that is 0 or is located anywhere below 0 in the same column is not considered to sum. Calculate the total price of all the cells that are suitable for condition. Exa...
fbc5bf8120a051749d8b83f77ae39f58681bf0f0
littlebluewhite/Backen-Engineer-Exercise
/Backen Engineer Exercise(python)/solution1.py
968
4.125
4
# 1. Please implement a string function in a numeric format in a language that you # are good at. And mark every three digits with a comma. Please attach unit # test. # f(9527) => "9,527", f(3345678) => "3,345,678", f(-1234.45) => "-1,234.45" def numeric_format(s): s = str(s) result = "" int_list...
3bca70bdc292e39841b0f4f1ef0e1268cf919c56
GuanzhouSong/Leetcode_Python
/Leetcode/81. Search in Rotated Sorted Array II.py
760
3.59375
4
class Solution: def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: bool """ start = 0 end = len(nums) - 1 mid = -1 while start <= end: mid = (start + end) // 2 if nums[mid] == target: return True if nums[mid] < nums[end] or...
1a08d6a97969400717246d6eb83eaaff027bd1bd
zhiyunl/lcSolution
/0938RangeSumofBST.py
1,912
3.8125
4
""" Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: Input: root = [10,5,15,3,7,null,18], L = 7, R = 15 Output: 32 Example 2: Input: root = [10,5,15,3,7,13,18,1,null,6], L =...
65ffd09d4d2d792f58d772e43a8253587a66813c
anupamnepal/Programming-for-Everybody--Python-
/3.3.py
621
4.46875
4
#Write a program to prompt the user for a score using raw_input. Print out a letter #grade based on the following table: #Score Grade #>= 0.9 A #>= 0.8 B #>= 0.7 C #>= 0.6 D #< 0.6 F #If the user enters a value out of range, print a suitable error message and exit. #For the test, enter a score of 0.85. score = raw_i...
ae32a925f8cfaca533ee5ebe642ae169010d3aa3
FigNewton0/Python-Project-Portfolio
/Term 3/BlackJack/cards.py
2,372
4.03125
4
import random class Card(object): """a playing card""" RANKS = ["A","2","3","4","5","6","7", "8","9","10","J","Q","K"] SUITS = ["♣","♢","♡","♠"] def __init__(self,rank,suit, face_up = True): self.rank = rank self.suit = suit self.is_face_up = face_up ...
ce4c30f7e48e51d30dc29c094badfecfe05899ca
fekisa/python
/lesson_4/homework_4_6.py
764
4.34375
4
''' 6. Реализовать два небольших скрипта: а) бесконечный итератор, генерирующий целые числа, начиная с указанного, б) бесконечный итератор, повторяющий элементы некоторого списка, определенного заранее. Подсказка: использовать функцию count() и cycle() модуля itertools. ''' from itertools import count from itertools i...