blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
ad4331718451489cd2790c8e55d25fecc7fb12a6
thembela1999/PythonFundamental-Week1-4
/PYTHON FUNDAMENTALS -(week5)/WEEK 1/Day 2/Activity1.py
427
3.953125
4
# Multi_dot is used to compute the dot product of two or more arrays in a single function call, # while automatically selecting the fastest evaluation order. from numpy.linalg import multi_dot import numpy as np # calculate the product of the following arrays A = np.array([ 1.2, 0.5, 1 , 5]) B = np.ar...
ba17fb592ca9e510a62caedec08bac1c130e53c3
ypmoraes/Curso_em_video
/ex052.py
1,186
4.34375
4
''' ######################################################################################## ## Enunciado: Faca um programa que leia um numero inteiro e diga se ## ## ele eh ou nao um numero primo ## ## ...
fc0a3bdee121f5c523e0d442b2729f53522a78d6
FitzFrosty/python_work
/auto_boring_1.py
317
3.875
4
print("Hello World") print("Please, tell me your name: ") user_name = input() print("Nice to meet you" + user_name) print("Did you know the length of your name is: ") print(len(user_name)) print("How old are you?") user_age = input() print("Wow! You will be " + str(int(user_age) +1) + " in a year") test
d04b84ded296861a5736c2411179977dc251adb2
anhtylee/abx-algorithm-exercices
/src/optimal-division.py
577
3.59375
4
# url https://leetcode.com/problems/optimal-division/ # writtenby:anhty9le class Solution: def optimalDivision(self, nums): """ :type nums: List[int] :rtype: str """ n = len(nums) if n == 1: return str(nums[0]) if n == 2: ...
4fbf36a903dc7432790b909bddb71bec93de931f
EndIFbiu/python-study
/04-循环/06-continue.py
152
3.828125
4
i = 1 while i <= 5: if i == 3: print('发现虫子不吃了') i += 1 continue print('吃第%d个苹果' % i) i += 1
5eec8fbd06fa474a377a5edb762fadf36899c8da
khrushv/omd
/omd.py
5,253
3.65625
4
# Stepanov Nikita from random import randrange def start(): print( 'У одного из учеников не получается домашка и ' 'нужно помочь ему и разобрать ошибки. Для этого есть выход - ' 'нам нужен ментон Утка-тив 🦆 🕵️ , поможем?' ) option = '' options = {'да': True, 'нет': False} ...
90c36e45c2229061c41e6a9c4b3e75ed3a1d9014
alijafargholi/code_puzzles
/puzzle_05/pile_of_cubes.py
1,010
4.375
4
""" Build a Pile of Cubes ===================== Your task is to construct a building which will be a pile of n cubes. The cube at the bottom will have a volume of n^3, the cube above will have volume of (n-1)^3 and so on until the top which will have a volume of 1^3. You are given the total volume m of the building. ...
63ebbfb951093559be7f3e40ce377bb78f2d6315
MudimukkuSreenath/python
/class.py
360
3.5
4
class First: def __init__(self,a,b): self.a = a self.b = b print("iam constructor") def sum(self): res=self.a+self.b print(res) '''def __str__(self): print("a="+str(self.a)+"b="+str(self.b))''' def __del__(self): print("iam destructor") ...
e930bbeabe7c6de336e0dcc83ba61e081b4b326b
Nyolczas/Python
/MEGA/basics/sliceList.py
423
3.875
4
myList = ["béka", "csöcs", 112] print(myList[0:2]) print(myList[1:2]) print(myList[1]) print(myList[:2]) print(myList[-2:]) napok = ["hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat", "vasárnap"] print(napok[0:5]) print(napok[4]) print(napok[4:6]) print(napok[6]) myList.remove(112) print(myList) myList....
bdf4674dbff21a23286c928d958e90fc4cbb2539
upasek/python-learning
/array/array_count.py
467
4.34375
4
#Write a Python program to get the number of occurrences of a specified element in an array. from array import * array = array('i', [1, 3, 5, 3, 7, 9, 3]) num = int(input("Input the integer : ")) count = 0 for i in array: if i == num: count += 1 print("Original array :",array) print("Number of occurrence...
367be05ef8bfcc2dbed50788b68c216a34b4440e
bielvieiralima/Projeto-part1-fis
/code.py
1,327
4.1875
4
from math import * c = 3*(10**8) pi = 3.1415 def comprimento_de_onda(): comprimento = float(input("Digite o comprimento de onda: ")) print() print("Escolha a unidade de medida :") print("1 - [nm]") print("2 - [µm]") print("3 - [mm]") print("4 - [m]") print("5 - [km]") opcao = int(i...
0b73ac0d84e3b042e6935bc0a260ac5f2fdadda5
LucasBalbinoSS/Exercicios-Python
/ExerciciosPython/ex007.py
214
3.625
4
n1 = float(input('\033[1;35mDigite a primeira nota: \033[m')) n2 = float(input('\033[36mDigite a segunda nota: \033[m')) m = (n1 + n2) / 2 print('\033[1;32mA média entre %.1f e %.1f é %.1f\033[m' % (n1, n2, m))
dbc279675b878be174c11f6f1a4187b3edb92d10
cdgus1514/ML
/KERAS/RNN/keras13_lstm_earlystoping.py
1,555
3.78125
4
from numpy import array from keras.models import Sequential from keras.layers import Dense, LSTM import random random.seed(1377) # 1. 데이터 x = array([[1,2,3], [2,3,4], [3,4,5], [4,5,6], [5,6,7], [6,7,8], [7,8,9], [8,9,10], [9,10,11], [10,11,12], [20,30,40], [30,40,50], [40,50,60]]) y = array([4,5,6,7,8,9,10,11,12,13,5...
fa927dd339642ef1ec3ae19bda1e9fe1ab5247ed
iaksit/MIN545
/Lecture1/sandbox.py
703
3.765625
4
# Our first sandbox # The following counts as a comment '''x = 0 # a_flag = True if x is 1: if a_flag: print('something') y = 4 else: print('something else') y = 0''' total = 0 x = None while x != 0: x = int(input("Enter a number")) total += x print('Total: {0}'.format...
97dee83e425479b4b3dbc75a300c627b2f6c5c02
soumyakuruvila/hw3-fa17-student
/hw3.py
5,646
4.125
4
################################## # # # Homework 3 # # Released: September 26, 2017 # # Due: October 10, 2017 # # # ################################## # Matrix Transpose # # Description: # Given an m x n matrix A, return ...
addd917c0f34b65d4e7fa27f082f3cbe61e90550
FernandoUrr/PythonProjects
/Learning_Python/learning_python_part1.py
1,309
3.53125
4
#Soluciones de todos los ejercicios en el apéndice D """Algoritmo para realizar descenso del gradiente""" from matplotlib import cm import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots(subplot_kw = {"projection":"3d"}) #Ahora, definir la función de costos def f(x, y): return x**2 + 3*y**2 +...
bb8be50feabc3ec84af6e123870afea927bed763
shuvamoy1983/Machine-learning-Tutorial
/ReadDataAndTrasformBadvalues.py
1,077
4.0625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt #Import the dataset dataset= pd.read_csv("/Users/shuvamoymondal/Desktop/Machine_Learning_Folder/Part_1_Data_Preprocessing/Data.csv") ## get indipendent variable columms which is also called Features.Means a property of your training data. ##If you...
cfcb5442c08d6db17519024ff06f2d9426e8ab05
fengrenxiaoli/Mypython
/罚球.py
319
3.828125
4
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from random import choice print( 'Choose one side to shoot:') print('left,center,right') you=input() print('You kicked '+you) direction=['left','center','right'] com=choice(direction) print('Computer saved '+com) if you!=com: print('Goal!') else: print('Oops...')
6a8db65ede2ee897ed5584d40b877a35e58d826b
davidbliu/coding-interview
/arrays/graph_practice.py
671
3.75
4
import Queue g={1: [2, 3,6], 2: [4, 5], 3: [6, 7],4:[8,9,13]} def bfs_levels(graph): keys = graph.keys() search_queue = Queue.Queue() for key in keys: search_queue.put(key) visited = set() level_queue = Queue.Queue() while not search_queue.empty(): curr = search_queue.get() if curr not in visited: prin...
add1d802aa3a88bf3138013e3a6f9342ccc02899
beauthi/contests
/training/leetcode/hard/sudoku-solver.py
2,760
3.65625
4
class Solution: def print(self, board: list) -> None: for line in board: for elt in line: print(elt, end=" ") print("") print("-" * 17) def isValid(self, board) -> bool: for index_line in range(3): for index_col in range(3): ...
56b359ae656320ee58f69ee57e98113fea3d9fa9
JanKesek/wordpress-themes-scraper
/filereader.py
538
3.703125
4
from os import listdir, remove from os.path import isfile, join class Reader: def __init__(self, path): self.path=path def getFiles(self): return [f for f in listdir(self.path) if isfile(join(self.path,f))] def getFileText(self,filename): f=open("testDir/"+filename, "r", encoding = "...
15e62cb90b17264e05e64ca8dde06d0a1a03f2e6
huyngopt1994/python-Algorithm
/green/green-08-sort/bai_5_sort_odd_even.py
995
4.25
4
number = int(input()) numbers = list(map(int, input().split())) def is_odd(number): # check so le if number % 2 != 0: return True else: return False def bubble_sort(numbers): for i in range(len(numbers) - 1): if is_odd(numbers[i]): i_odd = True else: ...
660e66c853f635cc5b8866c78e5016cd0d9428c2
RodrigoNeto/cursopythonyt
/aula5/aula5.py
643
4.34375
4
""" +, *, /, //, **, %, () """ print('Multiplicação *', 10 * 10) print('Repetição de String *', 10 * 'Rodrigo ') print('Adição +', 10 + 10) print('Subtração -', 10 - 10) print('Divisão /', 10 / 10) print('Divisão sem sobra //', 25 // 10 ) print('Potenciação **', 2 ** 2 ) print('Módulo/Resto da divisão %', 25 ...
7e4aa477f8b80e90a4c88cc8de184d476d39c7d7
Ivaylo-Atanasov93/The-Learning-Process
/Programming Fundamentals/Lists_Advanced-LAB/The Office.py
567
4.0625
4
string = input().split() happiness_factor = int(input()) all_employees_happiness = [int(employee) for employee in string] employees = list(map(lambda x: int(x) * happiness_factor, all_employees_happiness)) greater_happiness_employees = list(filter(lambda x: x >= sum(employees) / len(employees), employees)) if len(grea...
c23a76df72b2bdab314f764b289b507046f0cfa4
dddbuji/hello
/python练习5.py
167
3.78125
4
s=input("请输入车辆行驶的距离: ") s=eval(s) t=input("请输入车辆行驶的时间: ") t=eval(t) v=s/t print("车辆行驶的平均速度为{}". format(v))
b9a605797c84e14bceaacbb2fb706badef66c8f9
xiaohaiguicc/CS5001
/hw07_Chenxi_Cai/id.py
820
3.8125
4
""" Luhn's algorithm""" class Idnumber: """identification numbers""" def __init__(self, sequence): """constructor, sequence is a string""" self.id_list_reverse = [int(item) for item in reversed(sequence)] def judge(self): """overall procedure""" self.double() self....
a8eda7bdfc4a951d0d2e01ca78e414a08519b004
pedireddy/guvi_codekata
/p16.py
525
3.609375
4
def prime(a): flag=0 for x in range(1,a+1): if((a%x)==0): flag=flag+1 return flag def res(y,z): list=[] for x in range(y+1,z): if(prime(x)==2): list.append(x) for x in range(len(list)): print(list[x]) if(len(list)==0): ...
fbe465d4d41f20baa4ed15fb03e0e626e10ab6de
botaklolol/Kattis
/bet.py
1,560
3.671875
4
<<<<<<< HEAD import sys import math def choose(a,b): # a!/(b!(a-b)!) return math.factorial(a)/(math.factorial(b)*math.factorial(a-b)) def main(): steps = int(sys.stdin.readline()) for i in range(steps): line = sys.stdin.readline() line = line.split() R = int(line[0]) ...
e9ea50bbf34ad4f74ae759b8211d060a385040d2
jwstes/BlueLeg
/Receipt.py
1,265
3.546875
4
from datetime import datetime class Receipt(): def __init__(self, items, customerID): self.__items = items self.__customerID = customerID self.__date = self.generate_date() self.__totalPrice = self.generate_totalPrice() def generate_date(self): y = datetime.now(...
4114e92a5b31f15c5bac53be196bd184e22311eb
aeaziz/CQA-for-primary-keys-Datalog-Rewriter
/datalog.py
6,347
3.515625
4
# Represents an atom class Atom: def __init__(self, name): self.name = name self.content = [] self.is_key = [] self.is_variable = [] self.consistent = False self.negative = False # Returns the variables appearing in this atom def get_variables(self): ...
1582799f95c52edf860ce2891d140747c62dc928
nanersmariee/Labs_AnnaMarie
/oo-melons/melons.py
1,826
4.03125
4
"""Classes for melon orders.""" from random import randint from datetime import time class AbstractMelonOrder(): def __init__(self, species, quantity, country_code='USA'): """instantiate a melon order""" self.species = species self.quantity = quantity self.shipped = False ...
b9592d2db51ff82b78534e7b20ed262f63301dd1
EricksonSiqueira/curso-em-video-python-3
/Mundo 2 estruturas condicionais e de repeticoes/Aula 13 (for)/Desafio 047 (Contagem de pares).py
254
3.75
4
# Crie um programa que mostre na tela todos os números # pares que estão no intervalo entre 1 e 50. i = 0 print('-='*5 + 'Tabela de pares' + '-='*5) for c in range(0, 51, 2): if c > 0: i += 1 print(f"Par[{i}] = {c}") print('=-'*15)
64b69e62bf788c1770f48f508867b2020a19e976
rishinkaku/Software-University---Software-Engineering
/Python_Advanced/Comprehensions/Heroes Inventory/Heroes Inventory.py
662
3.8125
4
def inventory_(heroes): inventory = {} for hero in heroes: if hero not in inventory: inventory[hero] = {} command = input() while command != 'End': data = command.split('-') name = data[0] item = data[1] cost = int(data[2]) if name in inventor...
41e900d23662969b42fc6e0849bce6589cb1daa0
paulnicholsen27/Euler
/42 - Coded Triangle Numbers.py
1,441
4.09375
4
'''The nth term of the sequence of triangle numbers is given by, tn = n(n+1) / 2; so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the ...
eacf357f2a20b1f627104712611144069f116683
ruoqlng/RobotTeamProject
/libs/robot_controller.py
9,080
3.640625
4
""" Library of EV3 robot functions that are useful in many different applications. For example things like arm_up, arm_down, driving around, or doing things with the Pixy camera. Add commands as needed to support the features you'd like to implement. For organizational purposes try to only write methods into ...
c15339f777a3490c42cfff9b9c5c81775a608710
wuhaiwqy/MachineLearningPractice
/byhand/01_LinearRegression.py
2,277
3.859375
4
import numpy as np ''' 线性回归模型类 ''' class LinearRegression: def __init__(self, theta = None): self.theta = theta ''' 功能:模型训练 输入: data_x:二维数组,每一行是一条训练数据 data_label:训练数据对应的值 learning_rate:学习率 ''' def train(self, data_x, data_label, learning...
78028cd48cd0c7430e9781856c94d93046b195fa
robynfsj/cfg-python-project
/explore.py
2,945
3.828125
4
import manipulate import statistics import matplotlib.pyplot as plt # Print number of night's sleep contained in spreadsheet. def num_nights(): data = manipulate.duration_in_secs() print("The spreadsheet contains sleep data for {} nights." .format(len(data))) # Print the duration of the longest ni...
1f29a341d848c42e557c1610b4d4db1a6d82f137
reachtomrinal/PythonCoding
/app/CreatingVeriable.py
763
3.984375
4
# Section 1.2: Creating variables and assigning values # Integer a = 2 print(a) # Output: 2 # Integer b = 9223372036854775807 print(b) # Output: 9223372036854775807 # Floating point pi = 3.14 print(pi) # Output: 3.14 # String c = 'A' print(c) # Output: A # String name = 'John Doe' print(name) # Output: John Doe # ...
b8ddbcd866ba11738546c0ec5ec7c71f24479205
sukritgoyal/pythonFiles
/Python/simpletest.py
335
3.75
4
n = int(input()) i = 0 emps = [] while i < n: emps.append(input()) i+=1 empsChar = [] for emp in emps: empChar = [] for letter in emp: empChar.append(letter) empsChar.append(empChar) for chars in empsChar: if chars != sorted(chars): print("YES") else: ...
6da0227b0b44d97ecbd4fe95b2acdf0f4c1562b2
jyotichauhan20/function_question
/revarse.py
169
3.828125
4
def rev(string): rev=0 rev=len(string)-1 while rev>=0: print(string[rev]) rev=rev-1 string=input("enter the input=") rev(string)
c832286dbfeed2faa1ec0a5f8f73aca4e2e1b472
louispan123/COMP10001-Project-1
/Part 4.py
3,811
3.921875
4
#Sampling of habitats ''' Write a function optimise_study() that evaluates the effect that consecutive visits and unseen species thresholds have on the accuracy of diversity estimates. The function takes three parameters: sample_data is a list of lists of data collected over the course of multiple sampling visits;...
08ec11d772ace1e68160069cf473de4b78f3c353
Chary1729/GUVISET7
/s764.py
123
3.796875
4
inp1,inp2 = input().split() inp1=int(inp1) inp2=int(inp2) sum=inp1+inp2 if(sum%2==0): print('even') else: print('odd')
488ec670ce6fa676d96006b4f3d1df09243d4018
NorthcoteHS/10MCOD-Mosi-JONES
/user/calculator.py
160
3.734375
4
xString = input("Enter a number: ") x = int(xString) yString = input("Enter a second number: ") y = int(yString) print('', x, ' + ', y, ' = ',x+y, '.', sep='')
1b797cf9c4a78102c944fa6214c855d8a2508d7a
yevheniihalkin/Learning
/Hometask 3 - Yevhenii Halkin.py
4,389
4.03125
4
# Задание 1: У вас есть переменная value, тип - int. Написать тернарный оператор для переменной new_value по такому правилу: если value меньше 100, то new_value равно половине значения value, в противном случае - противоположне value число value = 77 new_value = value / 2 if value < 100 else -value print(new_value) #...
f6a9d45ef27987d505761b40c390103a025e7ca9
Lennoard/ifpi-ads-algoritmos2020
/iteracao/while/fabio_3/q5.py
226
3.890625
4
def main(): n = int(input('Insira um numero: ')) if n < 0: raise Exception("Deve ser positivo") f = n for i in reversed(range(1, n)): f = f * i print(f'O fatorial de {n} é {f}') main()
619372d811d942096343e91bc86acec9d484d9a6
AlexTyl/Python-learning
/Taskes/Task1.02.py
906
4.125
4
"""Получить все четырехзначные числа, сумма цифр которых равна заданному числу n.""" def summ_of_numerals(number): sum_numeral = 0 while number != 0: sum_numeral += number % 10 number //= 10 return sum_numeral def summ_of_numerals_equals_number(number): counter_num = 1000 while c...
b625f704bbafb0ccb29813918470b9a7c0a545c1
icelnwza/CP3-Chayanut-Lapanaphan
/Lecture71_Chayanut_L.py
507
3.734375
4
menuList = [] priceList = [] def showBill(): print("Food list".center(15,"-")) for i in range(len(menuList)): print(menuList[i],"=",priceList[i]) totalPrice() def totalPrice(): result = 0 for i in priceList: result = result+i print("Total Price =",result) while True: menuName...
c5dd9121cf2cba80f3e894d9eec06c21a8c48e52
MichaelWei1990/GoScheduleAlarm
/core/model/stopTime.py
929
3.703125
4
import time class StopTime: __stopID = "" __arrivalHour = 0 __arrivalMinute = 0 __headSign = "" def __init__(self, stopID, arrivalHour, arrivalMinute, headSign): self.__stopID = stopID self.__arrivalHour = arrivalHour self.__arrivalMinute = arrivalMinute self._...
61e054ec52e435ab43a989a23ac36c8f656c92e5
HagenGaryP/slack-bot-workshop
/bot.py
2,208
3.953125
4
# -*- coding: utf-8 -*- """ In this file, we'll create a python Bot Class. """ import os from slackclient import SlackClient class Bot(object): """ Instanciates a Bot object to handle Slack interactions.""" def __init__(self): super(Bot, self).__init__() # When we instantiate a new bot object...
17a07dfcf51032bfbe22e2300e8e36e1df232de0
piquesel/learn_python
/qcm_simple.py
3,911
3.671875
4
# Simple qcm program import random import sys choice = None # Questions du qcm questions = [('What is the average latency with OVP?', '10us'), ('What is the maximum throughput we can reach with AVP?', 'Line rate'), ('In OpenStack, what is Nova in charge of?','Compute'), ('In Op...
f0043c23114a92f5792215a29ef32447e4d6b352
carwima/FP_PROGJAR
/New folder/gui.py
1,090
3.640625
4
from tkinter import * mw = Tk() mw.option_add("*Button.Background", "grey") mw.option_add("*Button.Foreground", "white") mw.title('ChatApp') #You can set the geometry attribute to change the root windows size mw.geometry("500x500") #You want the size of the app to be 500x500 mw.resizable(0, 0) #Don't allow resizing ...
42e71a82f71ba0d96bbf0de674a8114e2d10f158
andipro123/PPL-Assignment
/4_Classes-2/shapes.py
3,372
4.1875
4
from abc import ABC, abstractmethod from math import sqrt #Base class class Shapes: def __init__(self): self._Type = '' #Protected member print("A shape has been created!") def get_Type(self): print(self._Type) def __del__(self): print('Shape has been de...
361bcb64ec3b66cb84ef67d8c225b8f88d83e4c5
IvanNaka/JornadaByLearn
/JornadaByLearn.py
791
4.09375
4
# Ivan Yudi Oda Nakatani 07/01/2020 primeironumero = int(input('Coloque o primeiro número: ')) segundonumero = int(input('Coloque o segundo número: ')) conta = str(input('Qual operação deseja fazer? ')) soma = primeironumero + segundonumero subtracao = primeironumero - segundonumero multiplicacao = primeironumero...
64ef59565dea9003268d7105bd88c1218a21289a
skyegrey/mth490project3
/project1.4.2.py
4,320
3.59375
4
import math import pandas import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # Predictor function based on sigmoid function # Input: Vector of X variables, Vector of C variables # Output: Predicted values from the function (between 1 and 0) def predictor_function(x_vector, c_vec...
599bcabceb8576b7bb96e64e94d69b9519378937
jeprob/datamining
/dm1_Similarity & Timeseries & Graphs/shortest_path_kernel.py
1,715
3.890625
4
"""Skeleton file for your solution to the shortest-path kernel. Student: Jennifer Probst (16-703-423)""" import numpy as np def floyd_warshall(A): """Implement the Floyd--Warshall on an adjacency matrix A. Parameters ---------- A : `np.array` of shape (n, n) Adjacency matrix of an input graph...
331373437ed315c5f06f9aa32a8da6ad498a8f6d
Itumeleng-1/function_101_assignment
/Square-root-function.py
2,035
4.0625
4
#Creating square-root function and calculating differences with the in-built math functions def mysqrt( a, x , e): """ Estimates the square root of a selected number 'a' from an initial estimate 'x', that is within an epsilon 'e' error margin""" while True: print(x) y = ( x + a/x)/2 if abs(y -x) < e: br...
4e1d636d6e9983baa23d0d1b9769839a9c251142
Leewongi0731/DailyCodeTest
/[백준 골드2] 1655번.py
815
3.6875
4
# 1655번: 가운데를 말해요 # binary search, insert 조합으로 하면 시간초과. # 배열의 item추가 시간복잡도를 줄이기 위해 좌(maxHeap), 우(minHeap)으로 구현 import sys import heapq N = int(input()) mid = int(input()) print( mid ) # 항상 len( left ) = len(right) or len( left ) = len( right ) + 1 left = [] # 가장 큰 값 -> maxHeap right = [] # 가장 작은 값 -> minHeap for _ i...
5c9183141128ca2d00b9bda0bfa3e0b11150c0d7
JaiIrkal/Stone-Paper-Scissors-Game
/gamemodule.py
2,874
4.15625
4
from random import choice def game(): computer_choice = ['stone', 'paper', 'scissors'] computer_turn = choice(computer_choice) player_choice = input("Enter stone, paper or scissors: ").lower() if player_choice != 'stone' and player_choice != 'scissors' and player_choice != 'paper': p...
d8e1ab6c84901181ef7450866caf871b775429f1
Gameatron/python-things
/CS1/Turtles/random_walk.py
1,301
4.09375
4
from turtle import * from random import randint, choice ############################## #a way of going to the home point with out making marks def go_home(t): t.penup() t.home() t.pendown() def rand_walk(t, steps): for i in range(steps): #generate randome number ...
f3e18581bc32a0e163d937a5d24cc0d75ffdba49
knwlim/leetcode
/week_1/Reverse_Linked_List.py
998
4.03125
4
class Stack_Solution: def reverseList(self, head: 'ListNode') -> 'ListNode': # save current listked list to stack stack = [] node_for_stack = head while node_for_stack is not None: stack.append(node_for_stack.val) node_for_stack = node_for_stack.next ...
5dd0a8ae8f01093ccf008631f0a969f43cbf09ab
ggwg/MultiplayerSnake
/Specimen.py
6,051
4.15625
4
# Simple Snake Game in Python 3 for Beginners # By @TokyoEdTech import turtle import time import random delay = 0.1 # Score score = 0 high_score = 0 class Gamestate: def __init__(self): self.wn = turtle.Screen() self.wn.title("Snake Game by @TokyoEdTech") self.wn.bgcolor("green") ...
03c6915848c840e23ef80b8f1a8cb5f79fdd2f6c
jessapp/coding-challenges
/printllreverse.py
157
4
4
# Print elements in a linked list in reverse order def reverse_ll(head): if head == None: return reverse_ll(head.next) print head.data
0f6723dd320e75b0e8b0b16973589d7280d745b2
nervaishere/DashTeam
/python/HOMEWORK/5th_Session/Answers/Class/3/(3).py
132
3.625
4
x=input("enter your text:") y=len(x) print(y) if y%2==0: print(x[int(y/2)]) else: print(x[int((y-1)/2)])
a8128c02d17d3aa19de9ee6249c129080505450c
Hoodythree/LeetCode_By_Tag
/Data_Structure_and_Alogrithm/Compute_conponent.py
466
3.859375
4
def power(base,exp): res = 1 # 保存结果 while exp: # 当指数不为0 if exp & 1: # 判断二进制最低位是否为1,如果为1,就把之前的幂乘到结果中。 res *= base base *= base # 一直累乘,构造 base^2 -> base^4 -> base^8 -> base^16 -> ... exp = exp >> 1 # 去掉指数的二进制最低位,继续判断 return res n = input() print('2^{0} = {1}'.format(...
921832e008a17ed1eae446d1042e68f24110e192
nkatynski/NicoleCode
/Delimiter_check/stack_delimiter.py
1,715
4.25
4
# Program to confirm proper bracket/brace/parenthesis delimiting in a stringLength # Stack implemented using collections module from collections import deque def balanceCheck(userInput): counter = 0 isBalanced = True delimStack = deque() # our stack is technically a dequ...
0fbf576bdc686928c82c5f9507bab4aa705035f2
HugoBahman/Assignment
/Revision, Development and Stretch and Challenge Excercises/Development Excercise 3.py
435
4.28125
4
#Hugo #Development Excercise 3 #16/09/14 print("This program takes your height and weight in inches and stones and then converts them to cm and kg.") inches_height = float(input("Please enter your height in inches: ")) stones_weight = float(input("Please enter your weight in stones: ")) cm_height = inches_heigh...
bc5367efb7f254368a865238266da72924473ef8
twistby/python-project-lvl2
/gendiff/diff_finder.py
1,492
3.609375
4
"""Find differencies.""" from typing import Any, Tuple ADDED = 'added' REMOVED = 'removed' NESTED = 'nested' UNCHANGED = 'unchanged' UPDATED = 'updated' def get_diff_node( diff_kind: str, first_value: Any, second_value: Any = None, ) -> Tuple: """Packs the difference in the dictionary.""" return ...
8b9ac54cf15648e5c5bb315fbd2e2d3bcffb5b9c
howraniheeresj/Programming-for-Everybody-Python-P4E-Coursera-Files
/Básicos/PygLatin.py
775
4.4375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- #o objetivo deste programa é mover a primeira letra da palavra para o final e adicionar ay. #Dessa forma, a palavra Batata vira atatabay pyg = 'ay' #primeiro define-se ay original = raw_input('Escolha uma palavra: ') #deixa um espaço para colocar uma palavra if len(ori...
1f709c4c27fc09efc82f9b444d3a9a878b928ce1
LindaSithole/git-basic-ex
/Level 0/Task4.0.py
272
4.125
4
def even_or_odd(): user_input = int(input("Enter Your Number: ")) even_numbers = [1,2,4,6,8,10] odd_numbers = [1,3,5,7,9,11] if user_input in even_numbers: print("even") elif user_input in odd_numbers: print("odd") even_or_odd()
98d0598345a87f62b43f4426a75764f486904ded
tedrepo/Algorithm
/Data structure and algorithm/2018-11-27-二分查找四个变形.py
2,482
3.765625
4
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2018-11-27 10:57:45 # @Last Modified by: 何睿 # @Last Modified time: 2018-11-27 11:28:11 import random import time numbers = random.choices(range(0, 10), k=15) numbers.sort() def find_first(numbers, x): left, right = 0, len(numbers)-1 ...
4db4d468b7e4e8befd8b0d6078ac5049fe4d54ab
dpalma9/trainings
/katas_python/20181020/src/poker/hand.py
2,945
3.578125
4
# -*- coding: utf-8 -*- from poker.card import Card from poker.exceptions import DuplicatedCardError class Hand(object): def __init__(self,hand): hand=hand.split(" ") self.hand=hand self.check_cards_in_hand() self.rank() def rank(self): self.check_if_rep_cards() self...
dd9f17a68a3b5774e05f822f5bf11cae054a5609
weshao/LeetCode
/321.拼接最大数.py
2,483
3.53125
4
# # @lc app=leetcode.cn id=321 lang=python3 # # [321] 拼接最大数 # # https://leetcode-cn.com/problems/create-maximum-number/description/ # # algorithms # Hard (43.13%) # Likes: 338 # Dislikes: 0 # Total Accepted: 21.9K # Total Submissions: 50.9K # Testcase Example: '[3,4,6,5]\n[9,1,2,5,8,3]\n5' # # 给定长度分别为 m 和 n 的两个数...
f7e50e963a5ec6c11bf047a9b7e08e84b4b5deae
edlorencetti/Python-3
/ex075.py
529
4.03125
4
num =(int(input('Digite o primeiro numero: ')), int(input('Digite o segundo numero: ')), int(input('Digite o terceiro numero: ')), int(input('Digite o quarto numero: '))) print(f'Vc digitou os numeros: {num}') print(f'O valor 9 apareceu {num.count(9)} vezes') if 3 in num: print(f'O valor 3 aparece...
78eb149bf0078b29df0b388f8d58d85e885776b3
Alyriant/pie
/dnd_char.py
2,639
3.515625
4
import heapq import math import random import typing NUM_STATS = 6 POPULATION_SIZE = 10_000_000 NUM_TO_FIND = 10 class Character: def __init__(self): self.stats = [] self.simple_weight = 0 self.rms_weight = 0 self.roll() def roll(self): for i in range(NUM_STATS...
f191ba454b3b2dc50632d90883b19a4fab148c8b
ShailChoksi/text2digits
/text2digits/text2digits.py
6,179
3.828125
4
from typing import List from text2digits.tokens_basic import Token, WordType from text2digits.rules import CombinationRule, ConcatenationRule from text2digits.text_processing_helpers import split_glues, find_similar_word class Text2Digits(object): def __init__(self, similarity_threshold=1.0, convert_ordinals=Tru...
c71c6583c8591d5c2293daa37ebc4305361b0c7d
yaserahmedn/Leetcode---May-30-Day-Challenge
/day24.py
1,557
4.28125
4
#Construct Binary Search Tree from Preorder Traversal #Solution #Return the root node of a binary search tree that matches the given preorder traversal. #(Recall that a binary search tree is a binary tree where for every node, any descendant of node.left has a value < node.val, and any descendant of node.right has a v...
19e69d15dcd426f7ae222cfc7c03f4e264afbca6
xxbeam/leetcode-python
/answers/DeleteDuplicates.py
1,830
3.671875
4
# 82. 删除排序链表中的重复元素 II import ListNode class Solution: def deleteDuplicates(self, head: ListNode.ListNode) -> ListNode.ListNode: # 如果列表为空或者只有一个元素,直接返回 if not head or head.next is None: return head first = head has_dup = False head = head.next # 排除头部重复数据 ...
7fef1d2e7b76b66403577fa23e79aa787323ebf2
AvinciClub/python_lesson
/Jonathan/HW4/happybirthday.py
293
3.78125
4
#!/usr/bin/env python3 def singHappyBirthday(name): print("Happy Brithday to you") print("Happy Brithday to you") print("Happy Brithday to %s. " %name) print("Happy Brithday to you") print(" ") inputName = input ("Enter the name to sing happy birthday: ") singHappyBirthday(inputName)
4a5e8eda453f32a36b33afb18e6bcbd7a47ad30a
Besij/Coffee_Machine
/Coffee Machine/task/machine/coffe_machine_with_classes.py
4,959
4.125
4
class Coffemachine: running = False money_inside = 550 water_inside = 400 milk_inside = 540 beans_inside = 120 cups_inside = 9 e_water = 250 e_beans = 16 e_price = 4 l_water = 350 l_milk = 75 l_beans = 20 l_price = 7 c_water = 200 c_milk = 100 c_beans ...
4fe872405cdbea48c53b693864b4f70bb2f2b080
Aasthaengg/IBMdataset
/Python_codes/p03407/s330898319.py
120
3.515625
4
l1 = input('').split() a = int(l1[0]) b = int(l1[1]) c = int(l1[2]) if (a+b)>= c: print('Yes') else: print('No')
ebdb4611d8371587d6675b697d038a0e636ec64f
rowand7906/cti110
/M5HW1_TestGrades_DANTEROWAN.py
348
3.890625
4
#M5HW1_TestGrades_DanteRowan #June 27,2017 #CTI 110 M5HW1 Test Average And Grade #Dante' Rowan #This program displays a letter grade for each score and the average test score. #run the code for all in range(100, 90, 80, 70, 60): print('Enter five test scores') for all in range(A, B, C, D, F): print...
f2d0327b85ebbf13d90dcc150c59c82c59f0b46e
emilyemorehouse/Python-Babies
/weather.py
705
3.78125
4
#! /usr/bin/env python3 import requests from lxml import etree """ Baby script to scrape the current weather.""" def get_etree(url): urltext = requests.get(url).text return etree.HTML(urltext) def weather(): print ("Input the 3 character city symbol. Type 'exit' to quit.") city = input().strip() ...
3ace4594020f38b4ed61c9b2221a642c75ec1e66
zerobell-lee/baekjoon-algorithm-study
/lcm.py
356
3.625
4
import sys def lcm(a, b): if b > a: a, b = b, a def gcd(a, b): return a if b == 0 else gcd(b, a % b) g = gcd(a, b) return a * b // g num = int(sys.stdin.readline()) result = '' for i in range(num): a, b = map(int, sys.stdin.readline().rstrip().split()) result += str(lcm(a,...
4b52c350f588550884997024046b68f0b7b2c0f3
nunezisrael/Movie-Trailer-Website
/media.py
966
3.65625
4
import webbrowser class Video(): """This class defines what a video and also provides a method for playing a trailer of the video.""" def __init__(self, title, storyline, poster_image, trailer_youtube): self.title = title self.storyline = storyline self.poster_image_url = poster_image ...
c5ee6e53a7d5946089c3f127b0d6cab3837b8f09
akimi-yano/python-stack
/python_fundamentals/for_loop_basic_1/for_loop_basic1.py
1,203
4
4
# 1.Basic - Print all integers from 0 to 150. # for num in range (151): # print(num) # 2.Multiples of Five - Print all the multiples of 5 from 5 to 1,000 # for num in range (5, 1001, 5): # print(num) # 3.Counting, the Dojo Way - Print integers 1 to 100. If divisible by 5, print "Coding" instead. # If divisib...
e58f2b2882a8aec2c5df8531c71b1fd13f8e6066
MarlonVictor/pyRepo
/Aula02/at01.py
293
4.03125
4
## Faça um programa que dado o valor da temperatura em graus FARENHEIT, calcular e escrever o valor da temperatura em graus CELSIUS. F = int(input('Digite uma temperatura em graus FARENHEIT: ')) C = 5/9 * (F - 32) print('{0} graus FARENHEIT é equivalente a {1} graus CELSIUS'.format(F, C))
f162aebd2dce58853e01f1102e4d796694d0747d
Andrew-C-Stoops/pandas-challenge
/Final_hereos_of_Pymoli.py
8,894
3.515625
4
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd # In[2]: import numpy as np # In[3]: pd.read_csv("Resources/purchase_data.csv") # In[4]: purchasedata_df = pd.read_csv("Resources/purchase_data.csv") # In[5]: purchasedata_df # In[6]: # #Player Count #Display the total number of...
c93517ea5cf74a110bbf85b656b008d86035db34
projectman/algorithms
/bubble_sort.py
1,379
3.625
4
""" procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i = 1 to n-1 inclusive do /* if this pair is out of order */ if A[i-1] > A[i] then /* swap them and remember something changed */ swap( A[i-1], ...
d444e21ca7ced50acc6b9a31f53de355e8885ce4
wenboshi08/leetcode-everyday
/1740-FindDistanceinaBinaryTree.py
1,136
3.84375
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findDistance(self, root: TreeNode, p: int, q: int) -> int: def findLCA(node): if no...
6f453dd67875763447a31575a562cc5f8b84d685
anhyonchul/python
/ch02/calk_age.py
232
3.625
4
#나이 계산 프로그램 currentYear = 2021 birthYear = int(input("태어난 연도를 입력하세요 : ")) age = currentYear - birthYear + 1 print("%d년에 태어난 당신의 나이는 %d세 입니다" % (birthYear, age))
8ae06544660bc8d6a9332fb7e641ccdcec6e86a6
trofik00777/EgeInformatics
/probn/22.06/15.py
289
3.65625
4
def f(x, y, a): return (2 * x + 3 * y != 72) or ((a > x) and (a > y)) for a in range(100): fl = True for x in range(100): for y in range(100): if not f(x, y, a): fl = False break if fl: print(a) break
bf9f16bdebbb6c7739f4a82f7592f11df8d61d88
alexisbdr/face_recognition
/face_rec/test.py
4,476
3.734375
4
#!/usr/bin/python # The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt # # This example shows how to use dlib's face recognition tool. This tool maps # an image of a human face to a 128 dimensional vector space where images of # the same person are near to each other and ima...
6521d8dcb5e4b5ab0f760eda53916103490b89fe
prkpro/BST
/BST.py
3,878
4.125
4
# Binary Search Tree class Node: def __init__(self, val=None): self.value = val self.left = None self.right = None class BST: def __init__(self): self.root = None def add(self, value): """ Insert value iterating through either child if exist...
0a7c96690922b443f90ee92cf9a9316932553b65
ClayPalmerOPHS/Y11-Python
/selection005.py
453
3.90625
4
#Selection005 #Clay Palmer raining = str(input("Is it raining? (Yes/No) ")).lower() if raining == 'yes': windy = str(input("Is it windy? (Yes/No) ")).lower() if windy == 'yes': print("It is too windy for an umbrella") elif windy == 'no': print("Take an umbrella") else: print("I...
c8ccd14895a57879ee51ad098f1cbe3f75d802a0
thenickrj/Problem-Solving
/Distribute Candies.py
793
4.0625
4
# Distribute Candies """ Alice has n candies, where the ith candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visited a doctor. The doctor advised Alice to only eat n / 2 of the candies she has (n is always even). Alice likes her candies very much, and she wants to eat the...
6386cc4ec830f86654e404037be56550f108e001
AsyaAndKo/RTSlab1.1
/lab1.py
1,132
3.8125
4
import numpy as np import random from math import sin import matplotlib.pyplot as plt # expected value def expectation(x, N): return np.sum(x)/N # standard deviation def dispersion(x, mx, N): return np.sum((x - mx)**2)/N def frequency(n, w): return w - n * number # values for 11 variant n = 10 w = 1...
d1fe9b218d4f4ba388797837146e63444093c638
Rudresh17/GfG
/try.py
365
3.59375
4
cases=int(input("")) for m in range(0,cases): size=int(input("")) results=[] numbers=list(map(int, input (). split ())) for a in range(1,size-1): if(numbers[a]>numbers[a-1] and numbers[a]<numbers[a+1]): results.append(numbers[a]) if(len(results)>0): print(results[0]) ...
5457412acee1ae989e7d2bac13caf331d09a847e
mnovak17/wojf
/lab02/sequence.py
276
3.890625
4
#sequence.py #prints all squares down to 1 from a givenn number # Mitch Novak #1/7/09 def main(): start = eval(input("Enter a number:")) print ("Squares from", start, "down to 1:") for i in range(start, 1, -1): print(i*i, ",", end = " ") print ("1") main()
1adfeef3a61c6f8310feb6617a2eca522af5f2ca
allandelarosa/practice
/arrays-and-strings/integer-to-english-words/solution.py
1,859
3.546875
4
class Solution(object): def numberToWords(self, num): """ :type num: int :rtype: str """ # consider digits 3 at a time # add hundreds to string if valid # consider last two digits case by case # - 100 > x >= 20: _-ty _ # - 20 > x >= 13...
70fe63de265dabbc48ab39c38cd0012dbb36b268
paglenn/random
/python/538/heatfd.py
1,811
3.59375
4
# Program 8.1 Forward difference method for heat equation # Input: space interval [xl,xr], time interval [yb,yt], # number of space steps M, number of time steps N # Output: array w such that w[i-1,j] approximates solution at # (xl+i*(xr-xl)/M, yb+j*(yt-yb)/N) where 1 <= i <= M-1, 0 <= j <= ...