blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
1d204de21fe93e3a30164fbaaae7bb62fb21d74a
Saccha/Exercicios_Python
/secao08/ex06.py
601
4.15625
4
""" 6.Faça uma função que receba 3 números inteiros como parâmetro, representando horas, minutos e segundos, e os converta em segundos """ def tempo(horas,minutos,segundos): if horas // 1 == horas: if minutos // 1 == minutos: if segundos // 1 == segundos: convertido = horas * 60 * 60 conver...
7dbb69ba9a6adee26b4fe3c776f558c5c0b24348
anasekhar/PythonSamples
/list_dict_sort.py
278
4.28125
4
""" =sorting multiple dicts in a list """ def dict_sort(dic_list): return sorted(dic_list, key=lambda y: y['name']) ll = [{'name': 'Rajesh', 'age': 49},{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age':10},{'name': 'Ganesh', 'age': 24}] out = dict_sort(ll) print out
cee730cb4a0bc959b57ff949a2292416c2915aa4
ymeraz52/MyRepo
/food.py
489
4.125
4
my_list = [] print(input("What is your favorite food? ")) my_list.append(input) while True: question = (input("Add another:\y|n: ")) if question == "y": my_list.append(input("Give me another food ")) continue elif question == "n": break else: print("You did not give a fo...
eac11be5da3e31a4530d93a55300e9edfd0bdc43
feapoi/leetcode
/tree/invert_binary_tree.py
661
3.984375
4
# problem: # 翻转整个树 # # solution # BFS import collections # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def invertTree(self, root): """ :type root: TreeNode :rtype: Tree...
205273cfd912f6cd038512eedda20559ccb3d19c
xiaoran-w-li/python-challenge
/PyPoll/main.py
2,714
3.765625
4
import os import csv print ("Election Results") print ("----------------------------------------------") # Set path for file poll_data_csv = os.path.join("Resources", "election_data.csv") # Open the CSV, find number of votes with open(poll_data_csv) as datafile: datafile_reader = csv.reader(datafile, delimiter="...
4e24cdbcfb82671701abf7cd2ab26dd36277e09f
jnash67/eulerpython
/euler14.py
744
3.890625
4
def collatz(n): yield n while n != 1: n = n / 2 if n % 2 == 0 else 3 * n + 1 yield n def collatz_count(n): c =0 for val in collatz(n): c += 1 return c max = 0 maxi = 0 for i in range(1000000,1,-1): c = collatz_count(i) if (c>max): maxi=i max = c pri...
2a3712e3ca0261dab3fc63b66d982c8e18b3c1e7
Shrikar2/My_Python
/Task_10.py
312
3.828125
4
class rectangle: def __init__(self,l,w): self.length=l self.width=w def area(self): print("Area of the reactangle is",int(self.length)*int(self.width)) Area=rectangle(input("Enter the length of the rectangle:" ),input("Enter the width of the reactangle: ")) Area.area()
dbe7cff873a199778772283ca35516e62c649e07
yeon4032/STUDY
/GIT_NOTE/03_python/chap04_regExText/exams/exam01.py
653
3.828125
4
''' 문1) 다음 emp '입사년도이름급여'순으로 사원의 정보가 기록된 데이터 있다. 이 벡터 데이터를 이용하여 사원의 이름만 추출하시오. # <출력 결과> names = ['홍길동', '이순신', '유관순'] ''' from re import findall # <Vector data> emp = ["2014홍길동220", "2002이순신300", "2010유관순260"] print(findall('[기-힣]{3,}',emp)) names=[] for w in emp: re=findall('[가-힣]{3,}',w) print(r...
dd15ab2734c80dbde1864cdaa61026b1a3a16a1d
AN1ANG/pythonProject
/test.py
461
3.984375
4
heights = input('输入你的身高(CM):') weights = input('输入你的体重(KG):') heights = float(heights) weights = float(weights) bmi = weights/((heights/100)**2) print("%.2f" % bmi) if bmi<18.4: print('你的BMI类型是:偏瘦') elif bmi >=18.4 and bmi < 23.9: print('你的BMI类型是:正常') elif bmi >=24 and bmi <27.9: print('你的BMI类型...
91ec104714aa4c1b9c83159a47ff4390fc746db8
shivasaivardhan/demo
/Arrays/arrays 1.py
457
3.671875
4
import numpy as np #declaration of array(contains elements of same data type only) A= np.array([1,2,3,4,5]) B= np.array([1,2,3,4,5,12.7]) C= np.array([1,2,3,4,5,'shiva']) #printing array print(A) print(B) print(C) #Type of array print(type(A)) print(type(B)) print(type(C)) #size of array(rows x coloumns) ...
0a01420ebbc471004b624bef2cdcbf44bdb0b959
devJoelMichael/simpleInventorySystem
/inventorySystem/inv_app.py
1,363
4.125
4
# Make sure you have a clear readable Menu print(''' -------------------------- Welcome to ABC Electronics -------------------------- 1. View Items 2. Buy Items 3. Exit ''') # Make sure the choices are numerical and in order when customer is inputing their choice choice = int(input("Enter Your Option = ")) if choic...
013b58beacb2a8913cad6063f400be40ffbc1cd4
MRALAMs/first-project
/first poroject
364
3.875
4
#! /usr/bin/python3 def moadel(math,physics,dini,exersise): return ((int(math)*3)+(int(physics)*4)+(int(dini)*2)+(int(exersise)*1))*0.1 mylist =["reza","ali","mohamad"] for i in range(len(mylist)): a=input("math score ? ") b=input("physics score ? ") c=input("dini score ? ") d=input("exersise score...
b0973b946c105595b47471f05271d0f83cea2b65
akantuni/Kattis
/licensetolaunch.py
218
3.765625
4
x = input() list = input().split() list2 = [] lowest = int(list[0]) for i in list: i = int(i) list2.append(i) for e in list2: if lowest > e: lowest = e ind = list.index(str(lowest)) print(ind)
26ba9a93b1829dc56b6b5f7caba75d38f07c00e6
KULDEEPMALIKM41/Practices
/Python/Python Basics/58.bug.py
110
3.609375
4
i=1 while i=10: #not allow to write expression in place of condition. print(i,end='') i+=1 print('\n')
89daa768f97cbe12dca553bf9d31791f7366b60f
slashtea/Hands-On-python
/inport_statistics.py
458
3.84375
4
import statistics # Mean method calculates the average of a list. example_list = [5, 6, 8, 13, 16,80, 150] mean = statistics.mean(example_list) print(mean) ''' We can import all the module's methods by adding a star. from statistics import * y = variance(example_list) ''' ''' We can also import specif...
8a75badaaf2f9233006957e593be164778c430b7
kamaihamaiha/Tutorial
/python_tutorial/com/python/chapter9/user.py
1,908
3.8125
4
class User(): def __init__(self,first_name,last_name,age): self.first_name = first_name self.last_name = last_name self.age = age """登录次数属性""" self.login_attempts = 0 """增加登录次数 1次""" def increment_login_attempts(self): self.login_attempts+=1 """...
5437b5e281fb02528083c3e44c4f4c09fac1b8b0
Evergarden0101/deep_learning_exercises
/04_multi_output_networks/multi_output_regression.py
5,605
3.578125
4
import numpy as np import matplotlib.pyplot as plt import pandas as pd rng = np.random.default_rng(1) # 1. - Batch processing def batch(X, T, B=32): """ Create a batch from input data Args: X (np.array): the input data (N, D) T (np.array): targets (D,) B (int): batch_size """...
56885b822dc97f8a10be1bf35542924f60b22416
Cperez5401/Python
/_python/OOP/user.py
977
3.5625
4
class User: def __init__(self, name, email_address): self.name = name self.email = email_address self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount def make_withdrawal(self, amount): self.account_balance -= amount ...
de332837b36bceb03da177a4299fe023a8cd61b1
ylmzsmh/python-dersnotu
/10ockprşmb/11fonksiyonlar_return.py
396
3.765625
4
#!/usr/bin/python # -*- coding: UTF-8 -*- # fonksiyonların geriye değer döndürmesi return # def topla(s1,s2): # print("toplama sonucu = ",(s1+s2)) # # toplamaSonucu =topla(10,20) # print(toplamaSonucu) # yukarıdalki fonksiyon geriye değer döndürmez. def topla(s1,s2): sonuc = (s1+s2) return sonuc toplam...
77fdcd2adf984d5bc05c517a403c02f8dbc48be2
abdou-c/ExoPython
/exo6td.py
580
4.125
4
#Exercice 6 : #Faire un programme qui saisit les coordonnées de 2 points A (x1, y1) et b(x2, y2) et qui affiche la distance entre les 2 points. #Formule : distante = racine carrée de ((x1 – x2)2 + (y1 – y2)2) #Racine carrée : sqrt. Ex : sqrt(7) ; <math.h> from math import sqrt print("saisir les coordonnees de A") x1...
fe0ea0eaae359a9e47c641d1395be6418ce0f685
Shorotshishir/cse110_lab_with_python
/lab07task9.py
214
4.03125
4
number = int(input('Enter a height ')) for i in range(1, number + 1): # for k in range(number, i, -1): # print(' ', end="") for j in range(0, i+2): print(j, end='') print('')
d649b3eda9d801f16b590df51332760c83326717
akshatakulkarni98/ProblemSolving
/DataStructures/trees/smallest_common_region.py
1,464
4.21875
4
""" You are given some lists of regions where the first region of each list includes all other regions in that list. Naturally, if a region X contains another region Y then X is bigger than Y. Also by definition a region X contains itself. Given two regions region1, region2, find out the smallest region that contains...
3de1a0377df1278df7d29de95e661725bc48c048
Jackthebighead/recruiment-2022
/algo_probs/leetcode/lc496.py
1,094
3.65625
4
# 题意: 下一个最大元素问题:给你两个 没有重复元素 的数组 nums1 和 nums2 ,其中nums1 是 nums2 的子集。请你找出 nums1 中每个元素在 nums2 中的下一个比其大的值。nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位置的右边的第一个比 x 大的元素。如果不存在,对应位置输出 -1 。 # 题解:单调栈 # https://leetcode-cn.com/circle/discuss/kdY0zV/ class Solution: def nextGreaterElement(self, nums1, nums2): # inputs: nums1...
9bc0958518915fba6972a32a6da734129c7245a0
battalwara/battalwar_ankeeta_spring2017
/Assignment3_solution/Q4.py
4,277
3.59375
4
# coding: utf-8 # # Question 4 # - Use 'movies_awards.csv' # - Split each record into wins and nominations based on the different categories of awards (Oscar, Golden Globe, Primetime, BAFTA) # - Also, calculate total nominations and total wons and append them together # - Write output to CSV in the format specified ...
bb1c4894fe86eea09b604290f668e949c382156e
Savanahruss/HPM573S18_RUSS_HW1
/HW 1 Question 1.py
252
3.921875
4
#----Homework One----- #-----Question 1 #Part 1 x=17 #Integer y1=x print(type(y1)) #Float y2=float(x) print(type(y2)) #String y3=str(x) print(type(y3)) #Boulean y4=bool(x>8) print(y4) print(type(y4)) #Part 2 text='The value of x is '+y3 print(text)
0fa0c056022d1c6f9efb480561358d36b6307899
Andremarcucci98/CursoEmVideo
/PythonAulas_Desafios/Desafios/Desafio12.py
146
3.6875
4
n = float(input('Digite o preço de um produto: ')) f = n * 0.95 print('O preço do produto com 5% de desconto tem o valor de R${:.2f}'.format(f))
36fe1076acdec85dd7232b984dcff3ce0202255f
rudxosun/photography
/BJ/6-5.py
302
3.6875
4
import math N = int(input()) M = math.log(N,3) P = '' for i in range(N): for j in range(N): if j/3 < 3 : if j == 2: P += '' P += '*' else : P += '' print(P) P = '' ''' 1 3 7 9 19 21 25 27 n x n *** * * '''
3658ede857e7fd91e45acfeb32c8865aa61899dc
KMrsR/HMR_python
/PythonTutor/lesson_3_08.py
1,123
3.703125
4
''' Условие Даны значения двух моментов времени, принадлежащих одним и тем же суткам: часы, минуты и секунды для каждого из моментов времени. Известно, что второй момент времени наступил не раньше первого. Определите, сколько секунд прошло между двумя моментами времени. Программа на вход получает три целых числа: ч...
0da33ac9e35b85df84190cb1a7fb0e4b4b490842
Amir324/itc_bootcamp_winter2020
/Python/200308081506_Command Calculator.py
2,371
4.4375
4
import argparse import sys # constant for testing comand_calculator() NUMBERS = [3, 4, 5, 6, 9, 0] def add(num1, num2): """ Adds the two numbers :param num1: :param num2: :return: float res of sum of 2 num's """ return num1 + num2 def subtract(num1, num2): """ subtracts the two...
4cc16489d9c151a7f7b8cd964f8fdd3e9dd5f088
justinta89/Work
/PythonProgramming/Chapter 6/sumList.py
257
4.03125
4
def sumList(nums): # nums is a list of numbers. Returns the sum of the numbers in the list. total = 0 for n in nums: total += n return total def main(): numbers = [1, 2, 3] total = sumList(numbers) print(total) main()
232f675f61d9c4d9e1bf0d88622eb019ea657aec
0x-Robert/Algo_python_Study
/test.py
5,657
3.8125
4
# # from fractions import Fraction # # def rounding_floats(number1, places): # # return round(number1, places) # # def float_to_fractions(number): # # return Fraction(*number.as_integer_ratio()) # # def get_denominator(number1, number2): # # """ 분모를 반환한다.""" # # a = Fraction(number1, number...
0b10c7bbf1669b5ce91a87c59f9503260c143ffe
SviatoslavPereverziev/Course
/Задания /Задачи/lesson7/lock_func.py
194
3.625
4
def f(n): def f1(b): return n+b return f1 obj = f("14") obj2 = f("23") names = ["15","16","68","67"] for i in names: print(obj(i)) print(obj2(i)) f(45)
d661e46fe00f43db64c80e649802ed34bb9a2730
jinmyeonglee/practice_algorithm
/google_intern/gyu.py
858
3.578125
4
import bisect def find_gt(a, x): i = bisect.bisect_right(a, x) if i != len(a): return a[i] raise ValueError def find_word(words, input) : dict = {} for i in range(len(input)): if input[i] in dict: dict[input[i]].append(i) else : dict[input[i]] = [i]...
b23f8bc81216aaa6e0ce037f05c3b9f325f91e1e
chamoddissanayake/Video-Editor-QA-Extractor
/functions/qulaity_analyzier/PeriodCheck.py
2,879
3.59375
4
import datetime """ Author: Bandara A.B.C.N Student ID: IT18117356 Group ID: 2021-064 """ class PeriodCheck: def __init__(self, frames, period): """ Args: frames: Analyzed frames period: no need minimum time period """ self.__frames = frames self.__...
01c8dce545f4093aa6af3f8dae499404c37343f8
MichaelW496/PythonHW1
/strukture.py
249
3.515625
4
moja_lista = {3, 7, 8, 2} lista_stringova = {"haha", "bla", "šuš", "a", "b", "c", "d"} prazna_lista = {} miks_lista = {3, False, "hihi"} lista_stringova.add(17) print(lista_stringova) for s in lista_stringova: print("novi član liste: ", s)
1a56ec3f1ae424eb184249ed5d1a88974cc70055
sujith1919/TCS-Python
/classroom examples/file1.py
514
3.859375
4
#writing into a file f=open("a.txt","w") f.write("this is line number one\n") f.write("this is line number two\n") f.write("this is line number 3\n") f.write("four\n") f.write(str(5)) f.close() #reading from a file all at once f=open("a.txt","r") text = f.read() print(text) f.close() #reading from a ...
29ebe4f806786024a2e9b09c6ecda3e170e62406
django000/bitcoin-vitoz
/rabinchecker.py
892
3.515625
4
import random def miller_rabin_checker(n): if n <= 1: return False if n in (2, 3, 5): return True if str(n)[-1:] in ('0', '2', '4', '5', '6', '8') or eval('+'.join(str(n))) % 3 == 0: return False def to_binary(n): r = [] while n > 0: r.append(n % 2)...
4906a0032f147ca7229714be32dcfab24546fddb
xiabofei/python_details
/grand_grand_parent.py
392
3.71875
4
#encoding=utf8 """ 从grand parent继承的private属性 python解释器是如何处理的 """ from pprint import pprint class A(): def __init__(self): self.__private = 'private in A' class B(A): def __init__(self): A.__init__(self) class C(B): def __init__(self): B.__init__(self) def f(self): pri...
956cc4304f17db5f2809fe381d82ff9273bee58d
ujin2021/AlgorithmForEveryone
/code/q9/q9.py
770
3.515625
4
# 쉽게 설멍한 삽입 정렬 알고리즘 # 리스트 r에서 v가 들어가야 할 위치를 돌려주는 함수 # r : 이미 정렬되어있는 리스트 def find_ins_idx(r, v) : for i in range(0, len(r)) : if v < r[i] : # i자리 학생보다 작으면 return i # 거기가 v의 자리 return len(r) # 모든 친구보다 v가 키가 크다면 마지막 자리 def ins_sort(a) : result = [] # 정렬된 값을 저장할 새로운 리스트 while a : ...
1d6cba59b687c5950fcb549edb578d6369624384
CodeIshitaDutta/Classwork
/Python/APCSP/catchATurtle.py
1,746
4.09375
4
# a121_catch_a_turtle.py """these are all the import programs and turtles""" import turtle as trtl import random as rand #tammy the turtle tammy =trtl.Turtle() tammy.shape("turtle") tammy.shapesize(2) tammy.fillcolor("light pink") #the scoring mechanism scorer =trtl.Turtle() scorer.penup() scorer.goto(-200,-200) scor...
11610a66c01be23aaeb5403bf06f029d521f37f4
Alekseevnaa11/practicum_1
/57.py
985
3.890625
4
""" Имя проекта: practicum-1 Номер версии: 1.0 Имя файла: 57.py Автор: 2020 © Д.П. Юткина, Челябинск Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru) Дата создания: 10/12/2020 Дата последней модификации: 10/12/2020 Описание: Решение задачи 57 практикума № 1 #версия...
510ce316fdd46e353802551c856c3526ba6255df
mrmmathias/521158S-NLP-project
/scripts/ambiguous_class.py
3,146
3.890625
4
# -*- coding: utf-8 -*- """ Created on Sun Oct 25 14:15:54 2020 This script is mostly for task 10 (and the following) - we're looking to establish "ambiguous" class based on the discrepancy between the sentiment polarity and actual review. This script calculates the difference between overall sentiment as seen by ana...
86b8357137d4d528a6b791318f4eb453bb24717e
olliveirasamira/Exercicios-Python
/009.py
719
4.03125
4
# n =int(input('Digite um numero')) # tabuada = (n*1), (n*2), (n*3), (n*4), (n*5), (n*6), (n*7),(n*8),(n*9),(n*10) # print('tabuada do numero {} é {} '.format(n, tabuada)) # codigo do prof num = int (input('Digite um numero para ver sua tabuada: ')) print('-'*12) print('{}x {:2} = {}'.format(num,1,num*1)) ...
9ffab277a17f2f8edb0ab23d5b43542a8b786277
rootroo123/simplemath
/2+2.py
211
3.953125
4
print ('welcome to trivia') print ('this is a one question simple math equation') score = 0 total_q = 1 ans=input ('what is 2+2?') if ans == '4': score+=1 print ('correct') else: print ("incorrect")
c3f7e131d8d250b90105c4b82729ebd05793c72e
nikhilsamninan/python-files
/day10/pattern.py
665
4.03125
4
row = 6 for i in range(row): for j in range(row - i): print("*", end=" ") for k in range(i): print(" ", end=" ") print("\n") # rows = 6 # for row in range(1, rows): # num = 1 # for j in range(rows, 0, -1): # if j > row: # print("*", end=" ") # ...
fed5b51e98cd48346f5a1197e3f978d736190d6f
xamuel98/Leetcode-Algorithm-Solutions-in-Python
/findingMinimumAndMaximumCharactersInAString.py
1,219
4
4
string = "grass is greener on the other side"; freq = [None] * len(string); minChar = string[0]; maxChar = string[0]; #Count each word in given string and store in array freq for i in range(0, len(string)): freq[i] = 1; for j in range(i+1, len(string)): if(string[i] == string[j] and ...
d7c5d5a3d7593d26290be904cd444192f87d22bf
antallen/PythonMaterial
/ch5/main.py
2,914
3.53125
4
############################## # Project: 大富翁遊戲主程式 # # Version: 0.1 # # Date: 2021/07/09 # # Author: Antallen # # Content: 使用 Player 物件 ############################## # 引用 random 類別中的 randrange() 函數 from random import randrange # 引用 Player 物件 import Player # 引用 Chance 物件 import Ch...
1a297ec0a386c63f0d3c912dec870cfd2086f7ab
IgorTelles9/ufrj
/COS110/exc15.py
678
3.6875
4
""" Esse programa checa se duas entradas são anagramas Exercício 15 dos laboratórios de Alg. Prog Outubro de 2020 """ def eh_anagrama(palavra_1, palavra_2): checkeds = [0]*len(palavra_1) if len(palavra_1) != len(palavra_2): return False equals = 0 for i in range(len(palavra_1)): ...
7f671a82de76c9f8f6bfaf50b80cbae005f63b1e
wmsj100/CodeSpace
/python/homework/range.py
448
3.71875
4
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2019 <@wmsj100> # # Distributed under terms of the MIT license. """ 手动实现range思路 """ def fn(start, stop=None, step=1): if not stop: stop, start = start, 0 list1 = [] while start < stop: list1.append(start) ...
3d0c8415ce9cc920e335cb804fdf208f9dc4b6a6
YaliixxG/keep-doing-exercises
/367.valid-perfect-square.python3.py
888
3.515625
4
# # [367] Valid Perfect Square # # https://leetcode-cn.com/problems/valid-perfect-square/description/ # # algorithms # Easy (37.89%) # Total Accepted: 3.2K # Total Submissions: 8.6K # Testcase Example: '16' # # 给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 # # 说明:不要使用任何内置的库函数,如  sqrt。 # # 示例 1: # # 输入:16 ...
547bd9ea976fa5b783a27d8474fcc83f883c6b98
akjadon/Deep-Learning
/ANN/1-1-regression.py
1,504
3.890625
4
from keras.datasets import boston_housing from keras.models import Sequential from keras.layers import Activation, Dense from keras import optimizers (X_train, y_train), (X_test, y_test) = boston_housing.load_data() model = Sequential() # Keras model with two hidden layer with 10 neurons each model.add(De...
222dcfc38e7d45f59ad2ea3d526efd42bcba4f66
lilharry/competition-prep
/maxsubarray/maxsubarray.py
255
3.640625
4
def maxsubarrayH(A, i, solution): def maxsubarray(A): solution = [A[0]] for i in range(1, n): solution.append(maxsubarrayH(A, i)) return max(solution) A = [-2, 1, -3, 4, -1, 2, 1, -5, 4] print(maxsubarray(A, 0))
28111dddf222a65dc656d6662ad82dbcea40402b
tramvn1996/datastructure
/linked_list/test_cyclicity.py
1,548
4.125
4
#Test if there's a cyclicity within a linked list #which means that there's a cycle within a list def has_cycle(head): #method calculating how long the cycle is def cycle_len(end): start, step = end, 0 while True: step += 1 start=start.next if start is end: ...
10fd96db9c0ed804201ffcde324aa05ad32c800f
HuDaMan0621/python-104-medium
/long_words.py
1,387
3.984375
4
# Given a word as a string, print the result of extending any long vowels to the length of 5. # Examples: # Good => Goooood # Cheese => Cheeeeese # Man => Man # Spoon => Spooooon # Hint: Consider using a second variable. word = input('user input ') for index in range(len(word)): #letter = word[index] if wo...
234b021666865eebfa632f34c6c03cdbf3f275d3
edu-athensoft/ceit4101python
/stem1400_modules/module_12_oop/old/study/Learning3.py
769
4.125
4
""" learning module class variables instance variables """ class Student: # class variables name = 'Noname' age = 0 class Teacher: lang = 'en' # instance variables def __init__(self, tname, age): self.tname = tname self.age = age class Worker: score = 0 def __ini...
79c284e24ed0b4e2f22d8f6ad9a8d05eb9756730
rafaelperazzo/programacao-web
/moodledata/vpl_data/59/usersdata/233/45007/submittedfiles/testes.py
85
3.6875
4
# -*- coding: utf-8 -*- #COMECE AQUI ABAIXO a=int(input('Digite:')) print(bin(a)[2:])
32bb83eaf2f1c82af14d7414dfb3fff2068d50cd
Trupti2502/Python-Programs
/Assignment3_1.py
700
3.984375
4
def Sum(List): sum=0 for i in range(0,len(List)): sum=sum+List[i] return sum def main(): arr=[] print("\nNumber Of Elements\n\n"); size=int(input()); for i in range(size): print("Enter element number",i+1) no=int(input()) arr.append(no) sum=Sum(arr) print("\n\nAddition of {} numbers is {}\...
b0c1f2034c5961d82b78117f5bb8dea282cd6dca
patriciobaez/algoritmos1
/ejercicios/ejercicio4.py
3,407
4.1875
4
"""ADIVINANZAS""" print("Turno de Usuario1") PALABRA = input("Ingrese una palabra para adivinar: ") NUM_LETRAS = len(PALABRA) print("\n\n\nTurno de Usiario2") ADIVINANZA = int(input("Adivina cuantas letras tiene la palabra: ")) if NUM_LETRAS == ADIVINANZA: print("\nMuy bien!\n") print("Turno de Usuario1") ...
47202a2f0bdd910bed9eda6577b999e2e0d036bd
LeonardoSaes/Exercicios-python-basico
/python básico/desafio69.py
671
3.8125
4
# Simulador de caixa eletrônico print('-' * 40) print('{:^40}'.format('BANCO SAES')) print('-' * 40) valor = int(input('Qual o valor que deseja sacar? R$ ')) total = valor cedula = 50 totcedula = 0 while True: if total >= cedula: total -= cedula totcedula += 1 else: if totcedula > 0: ...
dd76361723d7f4ed383b06a081d75edbc2f47650
FreddyLimachi/python-numpy-tkinter
/AlgoritmoReducir.py
7,546
3.703125
4
""" Este modulo contiene el algoritmo para la reduccion de matrices """ from InterfazGrafica import * class Reduccion(GUI): def __init__(self,Matriz,Valor): #Ejecutar la creacion de la ventana emergente para mostrar la reduccion de matrices self.TopMostrar(),self.reducir(Matriz,Valor)...
cbec53784a83fa629c65b1195e00c841efa8ef16
leepard1130/Python-Project
/assignment1/compute+primpt.py
1,160
3.703125
4
def compute_score(guess, position, word): score = 0 counted = []# 紀錄已經算過的位置 for i,char in enumerate(guess): if char == word[position+i]: score += 100 # print(i,char,word[position+i]) else:#如果不一樣則往後搜尋看有沒有沒算過且相同的字元 for j in range(len(word)): ...
b123063a4892c4cf52842af95debc6232e68f431
junyang10734/leetcode-python
/1533.py
1,604
3.953125
4
# 1533. Find the Index of the Large Integer # Binary Search # """ # This is ArrayReader's API interface. # You should not implement it, or speculate about its implementation # """ #class ArrayReader(object): # # Compares the sum of arr[l..r] with the sum of arr[x..y] # # return 1 if sum(arr[l..r]) > sum(arr[x..y]) #...
363a97cb1b9ea5301e4b2b135caa2bc3d77dab69
brianhardner/COSC
/ELIZABETH/Pretty Mortgage Calculator.py
1,080
4.15625
4
def mortgage(): print('****************************************') print('** The Ultimate Mortgage Calculator **') print('****************************************') princ = float(input('What is the prinipal ')) rate = float(input('"What is the interest rate (in percents) '))/1200 print('Your ...
6fa6fa4a0eb30299ab6e6fbbbd79be89fb411676
warnabas/codewars.org
/6kyu/longest_substring.py
1,487
4.21875
4
"""We have to find the longest substring of identical characters in a very long string. Let's see an example: s1 = "1111aa994bbbb1111AAAAAFF?<mmMaaaaaaaaaaaaaaaaaaaaaaaaabf" The longest substring in s1 is "aaaaaaaaaaaaaaaaaaaaaaaaa" having a length of 25, made of character, "a", with its corresponding ascii code equa...
1d82951784b73f3abe397a90bc3093924e837d55
ecly/kattis
/tripletexting/tripletexting.py
134
3.671875
4
import textwrap, collections s = input() words = textwrap.wrap(s, len(s) // 3) print(collections.Counter(words).most_common(1)[0][0])
ed8ce9bf29d8571b474c5fc1514c64fa41f596be
aryan1107/CS50
/pset6/python_Exercise/mario.py
367
3.953125
4
from cs50 import get_int import sys while True: height = get_int("Height: ") if (height >= 1 and height <= 8): break # prints Mario Block for i in range(height): # adds space for j in range(1, height - i): print(" ", end="") # adds # as per the block for k in range(i + 1): ...
c00eae8dbf8d041e5edbf997a53d247c35d89640
givewgun/python_misc_year1_CU
/matplot sincos.py
421
3.546875
4
#sin cos plot import numpy as np import matplotlib.pyplot as plt #calculate the coordinate x,y that will be on sine and cos graph x = np.arange(0 , 10*np.pi, 0.1) y_sin = np.sin(x) y_cos = np.cos(x) #Format/procedures of showing two sub-plot plt.subplot(2 , 1, 1) #2separateplane in one column, first plane plt.plot(x ...
cedd165926081066b9e6cbb2cc666a2b4db93a62
WilliamDoNguyen/Python_Algorithms
/en_dequeue.py
3,008
4.09375
4
class Node: def __init__(self, valueInput): self.value = valueInput self.next = None class SLLStack: def __init__(self): self.top = None # Add to top of stack def add(self, value): if self.top == None: self.top = Node(value) else: newnode...
055a58a09a5b109ce176159eae711a4d7a678e8e
TrevorEdris/fitness_reports
/util.py
553
3.828125
4
def banner(text, char='=', length=80): """ Create a simple banner surrounding :param text EXAMPLE: banner('Some Header', '=') returns =============[ Some Header ]============= :param text: The text to surround :param char: The character to surround :param text with :param lengt...
f2c3d7f5e183019f2a0dce3a6a6030a03cb6c8c8
rangerjo/python.casa
/examples/kap08-if/summe.py
342
3.5
4
#!/usr/bin/env python3 from functools import reduce sum = 0 for i in range(1, 1001): sum += i print('Summe der Zahlen von 1 bis 1000:', sum) sum = 0 i = 1 while i<=1000: sum += i i += 1 print('Das gleiche Ergebnis, diesmal in einer while-Schleife errechnet:', sum) sum = reduce(lambda x, y: x + y, list(range(...
374eb6c03300b5ed095b05d894d171250094dd53
hirak99/expt_GPIO
/3_input/gpio_in.py
1,521
4.09375
4
# For this, connect the LED as in experiment 1. Then connect a button with one # end to GND, and the other end to IN_PIN. No resistor is required for the # button but it will use the PULL-UP resistance operated by the software. import RPi.GPIO as GPIO import time IN_PIN = 16 OUT_PIN = 17 def code(): GPIO.setmode(GP...
ea872288c52bb3ecbf988eb98c7c313345a3df14
AdamZhouSE/pythonHomework
/Code/CodeRecords/2479/60677/259620.py
282
3.734375
4
times=int(input()) for i in range(times): str1=input() str2=input() answer=[] for i in str1: if i not in str2: answer.append(i) for i in str2: if i not in str1: answer.append(i) answer.sort() print("".join(answer))
fa1d5298e2100ab2152715d59ead939acbab3521
glenjantz/DojoAssignments
/pythonreview/comaprelists.py
917
4.40625
4
# Write a program that compares two lists and prints a message depending on if the inputs are identical or not. # Your program should be able to accept and compare two lists: list_one and list_two. If both lists are identical print "The lists are the same". # If they are not identical print "The lists are not the same....
98e2a9fbdc8445e1228ae02a807dff6f88dbd912
Jia35/LeetCode
/Challenge/c30-Day_LeetCoding/p678_medium.py
1,928
3.5
4
# 678. Valid Parenthesis String # https://leetcode.com/problems/valid-parenthesis-string/ class Solution: def checkValidString(self, s: str) -> bool: # lo = hi = 0 # for c in s: # lo += 1 if c == '(' else -1 # hi += 1 if c != ')' else -1 # if hi < 0: break ...
c993f06854e5a15dbca30671063cb16cfe8504b3
junglefire/introduction_to_ml_with_python
/chap02/linear/linear_lasso.py
2,347
3.671875
4
from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.linear_model import Ridge from sklearn.linear_model import Lasso import matplotlib.pyplot as plt # import pandas as pd import numpy as np # 导入mglearn模块 import sys sys.path.append("../") import mglearn X...
6a105f0086aed9f3aedc92875b2417cb38b9298d
llpyyz/ProjectEuler
/number60.py
6,575
3.5
4
""" David Schonberger Project Euler - problem 60 Prime pair sets of size 5 """ import math import itertools lower = 800000 upper = 900000 def is_prime(n): if n < 2: ret = False elif n == 2: ret = True else: ub = int(math.ceil(math.sqrt(n))) ret = True for i in range...
464ac087696a39df3f214a2a6237bf9fcaf82f5f
DaHuO/Supergraph
/codes/CodeJamCrawler/16_1_1_neat/16_1_1_gnim_the-last-word.py
242
3.59375
4
def last(S): rst = "" for char in S: rst = char + rst if char + rst > rst + char else rst + char return rst T = int(raw_input()) for t in range(1, T+1): S = raw_input() print "Case #" + str(t) + ": " + last(S)
7250437efbe3dbb71823003002cc5a5411c991b1
padmesky/hello-python
/grading_students.py
587
3.75
4
# You can find the problem from te following link # https://www.hackerrank.com/challenges/grading/problem # Grading Students import sys def solve(grades): # Complete this function for i in range(len(grades)): if grades[i]>= 38: dif = 5 - (grades[i]%5) if dif<3: ...
f7268c6726382633a5f5a79dcaf7a753aca2132e
Rivarrl/leetcode_python
/leetcode/301-600/380.py
1,123
3.765625
4
# -*- coding: utf-8 -*- # ====================================== # @File : 380.py # @Time : 2020/7/28 1:32 下午 # @Author : Rivarrl # ====================================== from algorithm_utils import * import random class RandomizedSet: """ [380. 常数时间插入、删除和获取随机元素](https://leetcode-cn.com/problems/insert-...
d35143a3ab987f416db41af124ee69d2e7a2cbf8
aqqg/Algorithms-and-Data-Structures
/大学作业/排序算法/冒泡排序-递归.py
446
4.03125
4
# Implementation of Recursive Bubble sort def bubble_sort(listt): for i, num in enumerate(listt): try: if listt[i+1] < num: listt[i] = listt[i+1] listt[i+1] = num bubble_sort(listt) except IndexError: pass return listt listt = [64, 81, 2, 11, 7, 115, 32] bubble_sort(listt) print("...
a7665b28f46c25421a22a23393a5fb15c7f3ed68
abrambueno1992/Intro-Python
/src/cal.py
2,279
4.625
5
# Use the 'calendar' module to draw calendars to the console # https://docs.python.org/3.6/library/calendar.html # # Use the sys module to look for command line arguments in the `argv` list # variable. # # If the user specifies two command line arguments, month and year, then draw # the calendar for that month. # Stre...
5fde3a4bce35446ae798dd23fb9bde1bff8ae2f4
lenghuang/SentimentAndStars
/SentStarResidual.py
1,254
3.53125
4
import json import csv from textblob import TextBlob ## Methods # method to get a converted star value based off sentiment def getSentStar(sent): return 2.2338*sent + 3 # method that returns sentiment of a given json object / dictionary's text key def getSent(n): blob = TextBlob(data[n]['text']) ...
eb28d773b9a404806a9aee0912a89d753f751e6f
Mrhairui/leetcode
/22.py
793
3.765625
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def swapPairs(self, head: ListNode) -> ListNode: dummy = ListNode(0) p = dummy while head: if head and head.next: p.ne...
42e8165beeda661d3d04338621dccfc6694ed3d4
longz113/python_work
/hello/order_pizza.py
320
3.90625
4
make_pizza=[] print('若想退出,请输入"退出"\n') while 1: materials=input("请输入披萨的配料:") if materials=='退出': break else: make_pizza.append(materials) print('已经添加'+materials+'\n') print('你的披萨配料包括:'+str(make_pizza))
e87a9515ceb98bb379db97e8721f6d42859acb88
icZsh/Genetsis
/data analysis.py
169
3.53125
4
#!/usr/bin/env python3 def sum(x, y): x += 1 y += 1 result = x + y return result if __name__ == '__main__': result = sum(1, 1) print(result)
3e83df0207fc9f67c55a13ce14316539f6b764de
Matth0s/Lista-3
/TXTs do Exercicio 3/Exercício 3.py
3,877
4.28125
4
''' Esse programa cria um arquivo com a frequencia das palavras de arquivos txt Aluno: Matheus Moreira do Nascimento DRE: 119042060 Curso: Matemática Aplicada Disciplina: Topicos da Matemática Aplicada A ''' print("...................................................................... ") print("Aqui tu pode criar um ar...
17de8bf3f3b6f898225ef2e4d32391340e0b57c1
dipanbhusal/Python_practice_programs
/ques4.py
536
4.21875
4
# 4. Write a Python program to get a single string from two given strings, separated # by a space and swap the first two characters of each string. def string_swap(string1, string2): modified_str1 = string2[0:2]+string1[2:] modified_str2 = string1[0:2] + string2[2:] result = modified_str1 + ' ' + modified...
e076e379a43657785bf5f540e6c5c83177a2940d
rostonn/pythonW3
/basic/10.py
146
4.15625
4
# Write a Python program that accept an integer (n) and computes the value of n+nn+nnn. n = int(input("Give me an integer: ")) print(n+2*n+3*n)
a59e7427ab0195774cee106d0f4019b06938ae04
TangTab/Data-Structures-and-Algorithms-in-Python
/src/ch05/dynamic_array.py
1,130
4.0625
4
import ctypes class DynamicArray: """A simplified Python list which provides low-level array. """ def __init__(self): """Create an empty array when initialied. """ self._len = 0 self._cap = 1 self._A = self._make_array(self._cap) def _make_array(self, cap): ...
93cd4d00511704ab9b7db6fce36fa32e549139a5
huanjinzi/python
/base/for_loop.py
154
3.90625
4
def main(): for num in [1,2,3]: print("for:" + str(num)) s = 0 while s < 5 : print("while:" + str(s)) s += 1 main()
16d2a7a8cab22336f579d8c18e07309ce1e13727
Ambahm/is210-week-05-Additional
/wk5_inverse_temp.py
1,642
4.40625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """Temprature Conversion This program does emperature conversion for Fahrenheit to Celsius, Kelvin to Celsius and Kelvin to Fahrenheit. This function takes 2 input for tempraturet to be converted. """ import decimal ABS_DIFF = decimal.Decimal('273.15') def temp_...
13aa59b8b29be3d268a0a2d7cb2989b5d669de56
mark-smits/CSD2
/csd2a/euclidean (eindopdracht)/src/seq_gen.py
2,557
3.5
4
# euclidean sequence calculator def euclidean_sequence_definer(steps, trigs): stepsize = int(steps/trigs) # kleinste stapgrootte (grootste stapgrootte is kleinste + 1) remainder = steps % trigs # modulo voor het bepalen van het aantal grote stappen numlarge = remainder # aantal grote stappen numsmall =...
2ec8f811c0d45d4a1390c41d820ad80c5c9fe44f
kkaixiao/pythonalgo2
/leet_0563_binary_tree_tilt.py
1,199
4.03125
4
""" Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree node values. Null node has tilt 0. The tilt of the whole tree is defined as the sum of all nodes' tilt. Example: I...
a3b391bd1bb22221b7be3c90cdc6bf21ec83d568
ksprakash/python-project
/datetime1.py
805
3.578125
4
from datetime import datetime import pytz time_utcnow=datetime.now(tz=pytz.UTC) print(time_utcnow) time_estnow=time_utcnow.astimezone(tz=pytz.timezone(zone='US/Eastern')) print(time_estnow) time_est=datetime.now(tz=pytz.timezone(zone='US/Eastern')) print(time_est) #append actually changes the list. Also, it takes ...
37d985dc0cfe1271a0edd35b97a35449b76bcd8b
frederico-prog/python
/cursoemvideo/aula19a.py
2,148
3.890625
4
''' Variáveis compostas - Tuplas - não são imutáveis () - Listas [Parte 2] - podem ser mutáveis [] ou list() - Dicionários - {} permite a personalização dos índices ''' # Declaração de dicionário # dado = {} # dado = dict() # # dado = {'nome': 'Pedro', 'idade': 25} # print(dado['nome']) # IMPRIME O VALOR DO CAM...
02ad1b6d972d78913b2901f59180cbd6c13bad61
chamathkaaa/roulette-game-using-Python
/roulette game using Python.py
1,578
4
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: import random print("Welcome") print("You have $1000. Good Luck") begin = 1000.00 while begin >= 0 and begin <= 1000: while begin != 0: print("---------------------------------------------") number = input("On which number you want to bet? ") ...
c245fbcc6c9134c5d059e3ffb194e3b6fdb819b8
mba-mba/HacktoberFest2020-2
/python/matrixmult.py
273
4.21875
4
#Matrix multiplication using numpy. import numpy as np # input two matrices mat1 = ([1, 6, 5],[3 ,4, 8],[2, 12, 3]) mat2 = ([3, 4, 6],[5, 6, 7],[6,56, 7]) # This will return matrix product of two array res = mat1 @ mat2 # print resulted matrix print(res)
cbd7bb85e193f6421d10e6d540270441ccdd4d49
looyea/PythonStudy
/NumPy/MatrixTest.py
224
3.5
4
# _*_ coding:utf-8 _*_ import numpy from numpy import matrix m1 = matrix([1,2]) m2 = matrix([3,4]) print(m1 + m2) print(m1 * m2.T) print(numpy.multiply(m1 * m2)) print (m1.mean()) print (m2.sort()) print (m2.argsort())
86759cd2e1b6c8415f32e183b70ee3f6ce4e2794
ipetrushenko-softheme/codejam
/implementation/19-1030-A.py
294
3.625
4
def read_tokens(): return input().strip().split(' ') def read_ints(): return [int(s) for s in read_tokens()] n, = read_ints() arr = read_ints() def solve(arr) -> str: for el in arr: if el == 1: return "HARD" return "EASY" ans = solve(arr) print(ans)
9c8752400d11db7a9138e4fac6a0423cf48512a2
yejikk/Algorithm
/알고리즘실습/190326/1~n까지의합.py
190
3.5625
4
import sys sys.stdin = open('1~n까지의합.txt') def numsum(n): if n <= 1: return 1 else: return n + numsum(n-1) N = int(input()) result = numsum(N) print(result)