blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
1a9bc5b9cf2bc221663353b194fcb5c9c061a7a0
william-james-pj/LogicaProgramacao
/URI/1 - INICIANTE/Python/1117 - ValidacaoDeNotas.py
202
3.859375
4
x = media = 0 while x != 2: nota = float(input()) if(nota < 0 or nota > 10): print('nota invalida') else: x += 1 media += nota print('media = {:.2f}'.format(media/2))
cd76e09d0338cbd191087f3a1c67f16c85d11cfa
william-james-pj/LogicaProgramacao
/URI/1 - INICIANTE/Python/1038 - Lanche.py
346
3.625
4
a, b = input().split() a = int(a) b = int(b) if (a == 1): print('Total: R$ {:.2f}'.format(4.0*b)) elif (a == 2): print('Total: R$ {:.2f}'.format(4.5 * b)) elif (a == 3): print('Total: R$ {:.2f}'.format(5.0 * b)) elif (a == 4): print('Total: R$ {:.2f}'.format(2.0 * b)) elif (a == 5): print('Total: R...
3463609f2a7ca21bf9ee2dbcc802fded8788e941
william-james-pj/LogicaProgramacao
/URI/1 - INICIANTE/Python/1080 - MaiorEPosicao.py
172
3.625
4
x = 1 max = 0 pos = 0 while x <= 100: num = int(input()) if(num > max): max = num pos = x x += 1 print('{}'.format(max)) print('{}'.format(pos))
35d59e68b0d0a7b4b2fe1198e41a5668611ab382
william-james-pj/LogicaProgramacao
/URI/1 - INICIANTE/Python/1078 - Tabuada.py
82
3.734375
4
n = int(input()) for x in range(1,11): print("{} x {} = {}".format(x, n, x*n))
a960e241f175b08f1900e06299450e06a8796b11
william-james-pj/LogicaProgramacao
/URI/1 - INICIANTE/Python/1012 - Area.py
283
3.75
4
a,b,c = input().split(' ') a = float(a) b = float(b) c = float(c) print('TRIANGULO: {:.3f}'.format((a*c)/2)) print('CIRCULO: {:.3f}'.format(pow(c,2)*3.14159)) print('TRAPEZIO: {:.3f}'.format(((a+b)*c)/2)) print('QUADRADO: {:.3f}'.format(b*b)) print('RETANGULO: {:.3f}'.format(a * b))
fe2f7feb571ce5667a5a82ba4df3ac7619c99843
Maurisan4011/cursoPython2019
/Primeros pasos/primera.py
1,521
4.09375
4
""" num1 = int(input('ingrese numero: ')) num2 = int(input('ingrese numero: ')) num3 print('la suma es: ', num1+num2) """ #la condicion el if va sin parentesis condition=True #ojo el True de Python es con mayuscula dia=input('Ingrese dia de la semana por favor: ') while condition: if dia=='lunes': print('in...
889c48a32ac0ad38b2700c7bf271f1a29dd17fa6
A01377451/Mision-10
/Mision_10.py
2,236
3.546875
4
import matplotlib.pyplot as plot #1 Nombres en mayusculas def mostrarNombresMayusculas(nombreArchivo): entrada = open(nombreArchivo, "r") equipos = [] entrada.readline() # Bye linea 1 entrada.readline() # Bye linea 2 for linea in entrada: linea = linea.upper() datos=linea.split(...
23cd8dee4b74f65b3d154d24ca58b0e7f68e3a99
mdaqshahab/OPA-Linux-Solutions
/python_IRA_24_July.py
1,661
3.53125
4
from collections import defaultdict class Book: def __init__(self, id,name,subject,price): self.id = id self.name = name self.subject = subject self.price = price class Library: def __init__(self,libname, booklist): self.libname = libname self.booklist = bookli...
d35bd127e519ec875b6be6ce4b4ccba42965589a
nandutejaswini/basic_programs
/venv/pattern.py
124
4.0625
4
x=1 while x<=5: print("#",end="") y=1 while y<=5: print("#",end="") y+=1 x+=1 print( )
5cf5dcba61e6b0473ea9409265d49dd6f6fda071
nandutejaswini/basic_programs
/venv/area1.py
100
3.875
4
x=1 while x<=100: if x%3!=0 and x%5!=0: print(x) x+=1 else: x+=1
4ebf82d6b21b4732960e7f096a581690865eda72
caroljunq/hackathon-globo
/trie.py
751
3.640625
4
TERM = '**' COUNT = '//' class Trie (object): def __init__ (self): self.root = {} self.root[COUNT] = 0 def add (self, a): n = self.root for i in a: if i not in n: n[i] = {} n[i][COUNT] = 1 else: n[i][COUNT]...
b0d523e2c88a10526e3ebb98ac771ad84d352260
TPOCTO4KA/Homework-Python
/Задание 4 Урок 1.py
607
4.15625
4
''' Пользователь вводит целое положительное число. Найдите самую большую цифру в числе. Для решения используйте цикл while и арифметические операции. ''' while True: number = input('Введите положительное число, пустая строка - окончание \n') if number == '': print('ну ты дурной') break else...
a888361d9dd3b74a13385787fb297d2246d44c43
TPOCTO4KA/Homework-Python
/Задание 2 Урок 2.py
868
4.28125
4
''' Для списка реализовать обмен значений соседних элементов, т.е. Значениями обмениваются элементы с индексами 0 и 1, 2 и 3 и т.д. При нечетном количестве элементов последний сохранить на своем месте. Для заполнения списка элементов необходимо использовать функцию input() ''' user_answer = input 'Введите список через...
6980003d73e19f96a7ec9e902fe4422f6849b682
khadija-94/GIZ-pass-python
/python-pass.py
445
3.609375
4
class Solution: def longest_palindromic(s: str) -> str: # Create a string to store the result palindrome = '' for i in range(len(s)): for j in range(len(s), i, -1): # break if len(palindrome) >= j - i: break # Update if match is found elif s[i:j] == s...
28ed32970dea5bf709fc7f0d839eb72962b58aac
Dobrydnyk-IP02/labs6
/Лабораторна робота 6/Лабораторна_робота_6.py
415
3.875
4
def user_input(): n=int(input("n = ")) return n def fact(k): if k==0: return 1 else: return k*fact(k-1) def draw_triangle(number): for j in range(0, n+1): for c in range(j+1): print(fact(j) // (fact(c) * fact(j - c)), end=" ") print() def do_exercise(n): if ...
08df597dcb7313edca3c7a3f64c58600a19ea360
Srisomdee/Python
/4.py
608
3.796875
4
print('โปรแกรมร้านค้าออนไลน์') print('-'*30) print('1.แสดงรายการสินค้า') print('2.หยิบสินค้าเข้าตะกร้า') print('3.แสดงรำยจ ำนวนและรำคำของสินค้ำที่หยิบ') print('4. ปิดโปรแกรม') a = (input('Enter yor Number :')) def matee(): print('1.หมูปิ้ง\n2.ไก่ปิ้ง\n3.ตับหัน\n4.หมูหัน\n5.แมวย่าง') matee() if a == 's': matee...
94a4e95a13557630c6e6a551f297a934b01e72f1
gadamsetty-lohith-kumar/skillrack
/N Equal Strings 09-10-2018.py
836
4.15625
4
''' N Equal Strings The program must accept a string S and an integer N as the input. The program must print N equal parts of the string S if the string S can be divided into N equal parts. Else the program must print -1 as the output. Boundary Condition(s): 2 <= Length of S <= 1000 2 <= N <= Length of S Ex...
cb332c445ab691639f8b6fb76e25bf95ba5f7af4
gadamsetty-lohith-kumar/skillrack
/Remove Alphabet 14-10-2018.py
930
4.28125
4
''' Remove Alphabet The program must accept two alphabets CH1 and CH2 as the input. The program must print the output based on the following conditions. - If CH1 is either 'U' or 'u' then print all the uppercase alphabets except CH2. - If CH1 is either 'L' or 'l' then print all the lowercase alphabets except CH2....
cafcf8fb503b66873a3c0ccf0bb0ab458364f058
forero/paulina
/python/hw3_2.py
438
3.5
4
import sys def factor(n, d = 2): if (n%d == 0): return [d]+factor(n/d,d) if (d*d > n): if (n != 1): return [n] return [] return factor(n,d+1) n = int(sys.argv[1]) if (not (0 < n <= 1000000)): print "El numero no se encuentra en el intervalo" f = factor(n) if (l...
51edd7c35ccfe2b7d07bcbfe97395f0c88c251fa
TAMU-BMEN207/Apple_stock_analysis
/OHLC_plots_using_matplotlib.py
2,535
4.25
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 13 21:20:18 2021 @author: annicenajafi Description: In this example we take a look at Apple's stock prices and write a program to plot an OHLC chart. To learn more about OHLC plots visit https://www.investopedia.com/terms/o/ohlcchart.asp #Dataset...
9359faab8429d81535d640576345ad09008b295f
cs-richardson/greedy-mando210
/greedy.py
468
3.953125
4
""" """ # Miki Ando change = float(input("How much change is owed? ")) coin = 0 change = change * 100 remainder = change % 25 coin = (change - remainder) / 25 change = remainder remainder = change % 10 coin = coin + (change - remainder) / 10 change = remainder remainder = change % 5 coin = coin + (change - remaind...
561527c84748d2f7b86aa33877f75ba22d1f46d3
ceeblet/RESTful_fibonacci_service
/fib/tests/test_fibonacci.py
963
3.75
4
import unittest from fib.fibonacci import Fibonacci class test_fibonacci(unittest.TestCase): def setUp(self): self.fib = Fibonacci() def test_min(self): self.assertEqual(self.fib.fibonacci(1), [0]) def test_2(self): self.assertEqual(self.fib.fibonacci(2), [0, 1]) def test_5(...
897bb22c890cf7488a644b95482b042bc1c35439
mateusandrade98/palestra-fazendo-as-maquinas-pensarem
/projeto.py
2,664
3.5625
4
# importar numpy # # variável linhas # variável colunas # # classe Estado # função recompensa # # classe RL # função qLearning # função posicaoLivres # # classe Jogo # função renderizar import numpy as np linhas = 3 colunas = 3 class Estado: def __init__(self, tabela): self.table = tabela def rec...
9e70b2ca95c65dded65bba4e659278954c471131
eajose/University-coding
/Códigos da faculdade/Cadastr_alunos_professores.py
10,530
3.546875
4
class professor: listaProfessores = [] def __init__(self, nome, cpf, dataNascimento, endereco, telefone, status = 'Ativo'): self.nome = nome self. cpf = cpf self.dataNascimento = dataNascimento self.endereco = endereco self. telefone = telefone self.status...
86d5a563242ff695c74d0a232a54463830ef714f
s-nilesh/Leetcode-May2020-Challenge
/18-PermutationsInString.py
1,841
3.78125
4
#PROBLEM # Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string. # Example 1: # Input: s1 = "ab" s2 = "eidbaooo" # Output: True # Explanation: s2 contains one permutation of s1 ("b...
68bb040d0e9828fc34660de7b3d0d4ffa6e36d2d
s-nilesh/Leetcode-May2020-Challenge
/14-ImplementTrie(PrefixTree).py
1,854
4.40625
4
#PROBLEM # Implement a trie with insert, search, and startsWith methods. # Example: # Trie trie = new Trie(); # trie.insert("apple"); # trie.search("apple"); // returns true # trie.search("app"); // returns false # trie.startsWith("app"); // returns true # trie.insert("app"); # trie.search("app"); // re...
d61be39fac7557857065fd0537cda8623e9486ee
maggielaughter/tester_school_dzien_5
/conditionals.py
189
3.8125
4
x = -10 if x < 0 and x % 2 == 0: print('x ujemny parzysty') elif x < 0: print ('x ujemny nieparzysty') else: print('to je inna liczba') y = ' ' if y: print ('y niepusty')
f86a42e476362420a6151a09d32eac415a1b7754
maggielaughter/tester_school_dzien_5
/data_test.py
519
3.796875
4
"""year = 2018 #month = 6 #day = 12 day_in_month=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if year % 100 != 0 and year % 4 == 0: print('rok przestępny') elif year % 100 == 0 and year % 400 != 0: print('rok nie jest przestępny') day_in_month[i-1]""" day_in_month=[31, 28, 31, 30, 31, 30, 31, 31, 30, 3...
1bc46f78503f255096c9c50c41bc1d18df8ef11f
maggielaughter/tester_school_dzien_5
/loop_while.py
520
3.609375
4
z = 0 while z < 10: print(z) z+=1 print(' ') n=64 i = 0 square=False done = False current_sqaure=i**2 while not done: if i**2 == n: square=True done=True elif current_sqaure > n: done = True i +=1 current_sqaure=i**2 if square: print('n jest kwadratem') else: p...
cc40241cb01e43421bb730e6f91c013434a13815
maggielaughter/tester_school_dzien_5
/poprawne_dni.py
560
3.734375
4
MONTH_LENGTHS=(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) year = 2016 month = 12 day = 31 #przestępność roku i ilość dni w lutym if month != 2: max_day = MONTH_LENGTHS[month-1] elif (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: max_day = 29 else: max_day = 28 if day < max_day: new_year...
2a68c6231ea0b26361d03e8195bb872a07f90fe5
moidshaikh/hackerranksols
/leetcode/leetcode#6.zigzag-conversion.py
659
3.53125
4
# https://leetcode.com/problems/zigzag-conversion/ class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s row_map = { row:"" for row in range(1,numRows+1) } row = 1 up = True for letter in s: row_map...
fddf5b28a8d6146825ab3d2edf6f6bdea81b700c
moidshaikh/hackerranksols
/hackerrank/love-letter-mystery.py
471
3.84375
4
''' Solution to hackerrank challenge https://www.hackerrank.com/challenges/the-love-letter-mystery ''' from itertools import islice def count_operations(word): diff = lambda x, y: abs(ord(x) - ord(y)) median = len(word) // 2 pairs = zip(word, reversed(word)) operations = sum(diff(x, y) for x, y in is...
70022b766cfe1edeeb269c43257befe117f61eee
moidshaikh/hackerranksols
/crazyPythonImplementations/geeks.py
209
3.953125
4
#Function to locate the occurrence of the string x in the string s. def strstr(s,x): #code here l = r = 0 for i in range(len(x)): print(x[i]) print(strstr('abcdfcde','cde'))
dfe853f4fb89cbefa48f5190f50d268d0d7cdc45
moidshaikh/hackerranksols
/leetcode/blind75/lc167_two_sum_II_input_array_is_sorted.py
394
3.5
4
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: l, r = 0, len(numbers) - 1 # left and right pointers while l < r: current_sum = numbers[l] + numbers[r] if current_sum > target: r -= 1 elif current_sum < target: ...
976090191c9b6316fccdd2167fbb576cab178933
moidshaikh/hackerranksols
/leetcode/lc20_valid_parantheses.py
478
3.6875
4
class Solution: def isValid(self, s: str) -> bool: stack = [] closeOpen = { ')':'(', ']':'[', '}':'{'} for c in s: if c in closeOpen: if stack and stack[-1] == closeOpen[c]: stack.pop() else: return False ...
da6291311cba04b222f094c1dfb0120f089ef5b5
moidshaikh/hackerranksols
/crazyPythonImplementations/quick_sort.py
468
3.78125
4
from typing import List import random def quick_sort(li: List) -> List: l = len(li) if l <= 1: return li else: pivot = li.pop() higher, lower = [], [] for i in li: if i > pivot: higher.append(i) else: lower.append(i) return quick_sort(lower) + [pivot] + quick_sort(higher) pr...
5e27c3e8302972736844b10e738aa097bdd65ea0
moidshaikh/hackerranksols
/hackerearth/practice/implementations/min_max_3.py
970
3.6875
4
# Given an array of integers . Check if all the numbers between minimum and maximum number in array exist's within the array . # # Print 'YES' if numbers exist otherwise print 'NO'(without quotes). # # Input: # # Integer N denoting size of array # # Next line contains N space separated integers denoting elements in arr...
9daee1e18f4a1ed1b117ccfe7ca5f08e7c4faeac
moidshaikh/hackerranksols
/hackerearth/test1.py
642
3.734375
4
# def power(num, x): # if x == 1: # return num # else: # return num ** power(num, x-1) def power(base,exponent): exponent = bin(exponent)[2:][::-1] result = 1 for i in range(len(exponent)): if exponent[i] is '1': result *= base base *= base return r...
8d306396734059730f71bece06988393ebc2c3d7
moidshaikh/hackerranksols
/interview_questions/c1.py
835
3.859375
4
# binary divide. if number is even half it. if no. is odd add 1 to it. count steps it takes to go to zero. # input: 3: output: 4 def bin_divide(s): # n = bin(s,2) # steps = 0 # while n != 0: # steps += 1 # input(n) # if n == 1: # break # if n%2 == 0: # ...
63d1c88374e05f3336681af6cb9b4c67cd225020
PykeChen/pythonBasicGramer
/zip.py
202
3.8125
4
matrix = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], ] print(list(zip(*matrix))) prices = [1, 3, 4, 5] pt = [[[0 for _ in range(2)] for _ in range(2)] for i in prices] print(prices[-1])
61ce86d7c0880053babdcab9d4dfc07f59e502b0
PykeChen/pythonBasicGramer
/Function.py
280
3.765625
4
valueBefore = 10 array = [2, "4", 5] def testFunParamsValue(x): x = 100 def modifyFunParamsValue(x): x[1] = 444 testFunParamsValue(valueBefore) print('valueAfter' + str(valueBefore)) modifyFunParamsValue(array) for i in array: print('arrary value ' + str(i))
d31db0c5c0344a0b306fa0a623378b2cf64f8615
PykeChen/pythonBasicGramer
/fileio.py
338
3.5625
4
for line in open("BasicGrammar/dict.py"): # print line, #python2 用法 print(line) with open('BasicGrammar/dict.py', 'r') as f: # read_data = f.read() # print(read_data) for line in f: print(line) # 写入文件 with open('BasicGrammar/wirte_test.py', 'w+') as f: f.write('This is a line by my c...
d532d34c6b8d7c523ec14f8dc974ffc4eef4ddf2
shensg/porject_list
/python3/python_dx/pyc2.py
882
4.125
4
class Start(): name = 'hello' age = 0 # 区分开 '类变量' '实际变量' # 类变量和类关联在一起的 # 实际变量是面向对象的 def __init__(self, name, age): #构造函数 __int__是双下滑线 '_' # 构造函数 # 初始化对象的属性 self.name = name self.age = age # print('student') def do_homework(se...
001ad3c4641323110d64eac09317cf16a2cb8eb9
JoyceTsiga/2020Finals
/Password_Manager_GJK.py
3,398
3.734375
4
import random from GenClass import PWGenerator passwordList = [] logInPW = [] def choice(): ui = input("do you want to create a Password (y or n) ") if ui == "y": userPassword = input("Put your new Password: ") passwordList.append(userPassword) elif ui == "n": PWGenerator...
c3a179e5eb2c5046e6c241182e99b190155bd53a
dtczhl/dtc-KITTI-For-Beginners
/python/object_viewer.py
5,883
3.546875
4
#!/usr/bin/env python """ Draw labeled objects in images Author: Huanle Zhang Website: www.huanlezhang.com """ import matplotlib.pyplot as plt import matplotlib.image as mping import numpy as np import os import pptk from shapely.geometry import Point from shapely.geometry.polygon import Polygon MARKER_COL...
b518c37abc704263af5e80be90d48cd8668f986c
koef/prometheus
/ls5/test2_counter.py
379
3.53125
4
#!/usr/bin/env python def counter(a, b): c = 0 processed = "" for c1 in range(len(str(a))): cur_dig_a = str(a)[c1:c1+1] for c2 in range(len(str(b))): cur_dig_b = str(b)[c2:c2+1] if cur_dig_a == cur_dig_b and processed.find(cur_dig_b) == -1: processed += cur_dig_b ...
6b406f7baf1fb65983f39c12da8c24e0faf76d42
koef/prometheus
/ls7/7.3/superstr_class.py
836
3.65625
4
# -*- coding: utf-8 -*- __author__ = 'koef' class SuperStr(str): def __init__(self, source_string): self.src_str = source_string def is_repeatance(self, s): if not isinstance(s, str) or self.src_str == "": return False src_len = len(self.src_str) s_len = len(s) ...
b321c9e98b1ed72a4f1a4ab118786d5a84fc3101
koef/prometheus
/ls4/test4_happy.py
580
3.78125
4
#!/usr/bin/env python import sys fist_num = int(sys.argv[1]) sec_num = int(sys.argv[2]) counter = 0 for cur_num in range(fist_num, sec_num + 1): cur_num = str(cur_num) while len(cur_num) != 6: cur_num = "0" + cur_num sum_first_three_digit = 0 for digit in cur_num[0:3]: sum_first_three_digi...
88329cac7ea25d94d0f83fc355cfd8bf5ff33b77
Software-Focus-Group/SFG-20
/Beautiful-Soup/pokemon.py
1,883
3.984375
4
from bs4 import BeautifulSoup #used for scraping import requests #used to send get requests to fetch the data from pprint import pprint #pretty print dicts # website to be scraped ; the pokemon database url = "https://pokemondb.net/pokedex/game/gold-silver-crystal" # We are hoping to scrape the website and collect ...
b65511f55175d9a2b431481a4f4694fb6d5ea0d7
AmaniAbbas/Coursera-Guided-Projects
/P2_pythonDataStructure/Lists1.py
991
3.9375
4
# افتح الملف وخزنه بمتغير fh = open('romeo.txt') # انشاء قائمة فارغة final_list = [] # استخدام الحلقة للتعامل مع سطور الملف سطرا سطرا for line in fh: # لتقسيم الكلمات في السطر لعناصر في قائمة split استخدم words= line.split() #استخدم الحلقة مرة أخرى للتعامل مع عناصر القائمة التي تحتوي على الكلمات for w...
112f32096314b4e30ec1bba4037c96aba7be18c4
manan057/python-code-exercises
/tic-tac-toe.py
624
3.9375
4
# Global Variables quit = False grid = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']] def print_grid(some_grid): print('\n------- Tic Tac Toe -------') print('\n col: 1 2 3') for row in range(len(some_grid)): print('row ' + str(row + 1) + ': ' + str(some_grid[row]) + ...
e8b6ef6df71a327b6575593166873c6576f78f7b
SirazSium84/100-days-of-code
/Day1-100/Day1-10/Bill Calculator.py
911
4.1875
4
print("Welcome to the tip calculator") total_bill = float(input("What was the total bill? \n$")) percentage = int(input( "What percentage tip would you like to give ? 10, 12 or 15?\n")) people = int(input("How many people to split the bill? \n")) bill_per_person = (total_bill + total_bill * (percentage)/100)/(peopl...
bd01fa079eecee6d85c8fe2a0517934a6cd2e6da
SirazSium84/100-days-of-code
/Day1-100/Day1-10/caeser_cipher.py
2,628
3.96875
4
from art import logo alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] print(logo) keep_going = "yes" def caesar(text, shift, direction): if direction == "encode": cipher_text = "" if shift > le...
c4c157cb35651a555f1ed29fe7d6d60ca45df0cf
JohTorm/IoT_Perusteet
/ovi.py
1,682
3.8125
4
oviKiinni = True oviLukittu = True oviTila = "" if oviKiinni == False and oviLukittu == False: oviTila = "Auki ja Avoinna" elif oviKiinni == True and oviLukittu == False: oviTila = "Kiinni ja Avoinna" elif oviKiinni == True and oviLukittu == True: oviTila = "Kiinni ja Lukittu" print("ovi on " + oviTil...
e6a272e49d2ff1c46f54d851168436d9328b0952
pddona/python_ejemplos
/PROBLEMAS resueltos/08_primo_4.py
1,371
3.984375
4
#!/usr/bin/env pyhton # __*__ coding:utf-8 __*__ def main(): import time print("NÚMERO PRIMO") numero = int(input("Escriba un número entero mayor que 1: ")) inicio = time.time() if numero <= 1: print("¡Le he pedido un número entero mayor que 1!") else: if...
883689898073925fb628776b9b49a7be4bb5a9eb
okfn/webstore
/webstore/security.py
2,027
3.5625
4
""" Very simple authorization system. The basic idea is that any request must come from a user in one of the following three groups: * 'world': anonymous visitors * 'user': logged-in users * 'self': users who want to access their own resources For each of these events, a set of actions is queried to se...
d0d4b7ee1bd93b246d31571ab880fc87c361da8c
Wolffoner/7541-Algoritmos-y-Programacion-II
/Clases/13-Salon-Python/salon.py
1,491
3.59375
4
#!/usr/bin/env python3 from pokemon import * from entrenador import * nombre = "salones/salon_estandar.txt" class Salon: def __init__(self): self.entrenadores = {} def agregarEntrenadorSiExiste(self, entrenador): if entrenador: self.entrenadores[entrenador.nombre] = entrenador ...
13297b32a90ce8fb19a2e5e05a288c2f879071a7
lingfeng23/pythonStudy
/03function/function.py
921
4.03125
4
import math # 调用函数 print(abs(-100)) # 定义函数 def my_abs(x): if x >= 0: return x else: return -x print(my_abs(-20)) # 空函数 def pop(): pass def move(x, y, step, angle=0): nx = x + step * math.cos(angle) ny = y - step * math.sin(angle) return nx, ny x, y = move(100, 100, 60,...
c71ee8a7038b1215dc9d9a06e424e4d1efc83f5c
TestardR/Python-Tips_Tricks
/large_numbers.py
174
3.8125
4
# we wan use underscore to help us read large numbers num1 = 10_000_000_000_0000 num2 = 1000_000_000 total = num1 + num2 # we can format numbers output print(f'{total:,}')
59fe77eafe43dcfe8848c6c969f254a414573952
kma501/JISAssasins
/question16_By_Mohiuddin.py
311
3.71875
4
class Find: def get(self,val): self.val=val self.val=self.val+1 print(self.val,"-->",chr(self.val)) self.val=self.val-2 print(self.val, "-->", chr(self.val)) give=input("give character you want :") print(give, "-->", ord(give)) obj=Find() obj.get(ord(give))
9ceb5314cf594e5237d837a82f517375a0831be2
kma501/JISAssasins
/question9_By_Mohiuddin.py
519
3.859375
4
class Calculate: r=0 sum=0 def find(self,val): self.val=val self.last=(self.val)%10 self.val = int(self.val / 10) while(self.val!=0): self.r=(self.val)%10 self.sum=self.sum+self.r self.val=int(self.val/10) self.first=self...
56c921dc0d0c41fc94e8ad49f4798d1fbc84f3f5
nickpostma/monopoly2
/property.py
1,467
3.53125
4
import unittest import player class test(unittest.TestCase): def test_property_class_callable(self): self.assertIsNotNone(Property(1,'')) def test_property_should_have_id(self): id = 5 self.assertEqual(Property(id,'').Id,id) def test_property_should_have_Name(self): name ...
b39534ece8562f881c6aae6f8da3bd1dfcc618b5
shyaboi/fedexshippingmacro
/clipboardtest.py
396
3.96875
4
from tkinter import Tk import keyboard while True: # making a loop try: # used try so that if user pressed other than the given key error will not be shown if keyboard.is_pressed('q'): # if key 'q' is pressed print(Tk().clipboard_get()) print('You Pressed A Key!') ...
beb1dafc2bc4b6acbbf4759691708ffd703ded66
leafcis/Tensorflow
/Python and Numpy/numpy different access.py
210
3.59375
4
import numpy as np matrix = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) print(matrix[np.array([0, 2, 4])]) # [1. 3. 5.] print(matrix < 3) # [True True False False False False] print(matrix[matrix < 3]) # [1. 2.]
78086a49fad55a6102472216103821a2b2eeebb0
jsmienk/BDCSH
/lesson7.9/mapper.py
460
3.5
4
#!/usr/bin/python """mapper.py""" import sys from datetime import datetime # Outputs key: WEEKDAY value: SALES def mapper(): for line in sys.stdin: row = line.split('\t') if len(row) < 5: continue # date date = row[0] # sales sales = row[4] ...
24a69e38cdc2156452898144165634fd6579ef6c
keyurgolani/exercism
/python/isogram/isogram.py
564
4.375
4
def is_isogram(string): """ A function that, given a string, returns if the string is an isogram or not Isogram is a string that has all characters only once except hyphans and spaces can appear multiple times. """ lookup = [0] * 26 # Assuming that the string is case insensitive string =...
cc935d4973347b1fb603cdecc5be422dcfa05a68
andyyang777/PY_LC
/977_双指针法.py
1,792
3.640625
4
# Given an array of integers A sorted in non-decreasing order, return an array o # f the squares of each number, also in sorted non-decreasing order. # # # # # Example 1: # # # Input: [-4,-1,0,3,10] # Output: [0,1,9,16,100] # # # # Example 2: # # # Input: [-7,-3,2,3,11] # Output: [4,9,9,49,121] # ...
629492dcbe85d8173cd8baac2abd8d6dcae35696
andyyang777/PY_LC
/Tree/105_Binary Tree preorder and inorder.py
1,890
4.09375
4
!!!!!!!!!!!!! 超级牛逼的解释,很容易理解 https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/solution/xiong-mao-shua-ti-python3-xian-xu-zhao-gen-hua-fen/ 网址在上 # Given preorder and inorder traversal of a tree, construct the binary tree. # # Note: # You may assume that duplicates do not ...
6a750dfd043559d6adcc25f3cb85ed8c3ae92840
andyyang777/PY_LC
/79_BestwayIthink.py
2,543
3.9375
4
# Given a 2D board and a word, find if the word exists in the grid. # # The word can be constructed from letters of sequentially adjacent cell, where # "adjacent" cells are those horizontally or vertically neighboring. The same let # ter cell may not be used more than once. # # Example: # # # board = # [ # ...
0e096a85876325977c5da4d202736c944cdc380c
andyyang777/PY_LC
/415_AddString.py
902
3.640625
4
# Given two non-negative integers num1 and num2 represented as string, return th # e sum of num1 and num2. # # Note: # # The length of both num1 and num2 is < 5100. # Both num1 and num2 contains only digits 0-9. # Both num1 and num2 does not contain any leading zero. # You must not use any built-in BigInteg...
180882089ce430d730b4e37012838039dfc9a9dd
andyyang777/PY_LC
/130_SurroundedRegions.py
2,606
4
4
# Given a 2D board containing 'X' and 'O' (the letter O), capture all regions su # rrounded by 'X'. # # A region is captured by flipping all 'O's into 'X's in that surrounded region # . # # Example: # # # X X X X # X O O X # X X O X # X O X X # # # After running your function, the board should be: # # ...
c35a79b70e706476522bbb2d65513ab40cf115aa
andyyang777/PY_LC
/394_DecodeString.py
1,681
3.796875
4
# Given an encoded string, return its decoded string. # # The encoding rule is: k[encoded_string], where the encoded_string inside the # square brackets is being repeated exactly k times. Note that k is guaranteed to # be a positive integer. # # You may assume that the input string is always valid; No extra whi...
d784502cb007208ac67e4bb140d308084eee549c
SrishtiToora/DS-codes
/BST.py
6,165
3.828125
4
import _collections class node: def __init__(self,key,left=None,right=None,parent=None): self.key=key self.left_child = left self.right_child = right self.parent = parent class binary_search_tree(node): def __init__(self): self.root=None self.size=0 ...
c06e8cb62b2acbeb3edc79741d02e0f1b07aa90f
ehoversten/Python_Fundamentals
/for_loop_basic1.py
1,242
4
4
# Basic - print all integers from 0 to 150 for i in range(0, 151): print(i) # Multiples of Five - Print all the multiples of 5 from 5 to 1,000,000 for i in range(5, 1000000): if i % 5 == 0: print(i) else: pass # Counting, the Dojo Way - Print integers 1 to 100. If divisible by 5, print...
0aeeefc41b62a40a3915179f4bb4bc9c160a2897
AlexanderNahr/mypy-ct-SESAM-pw-manager
/sesam.py
1,549
3.671875
4
# -*- coding: utf-8 -*- from hashlib import pbkdf2_hmac uppercase_letters = list('abcdefghijklmnopqrstuvwxyz') lowercase_letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') numbers = list('0123456789') special_characters = list('!@#$%^&*()_+-=[]|') password_character = uppercase_letters + \ lowercase_le...
a32129bb92165d51bfcab5ac32cc877ca236ab38
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe037.py
173
3.96875
4
#Desafio.030 n = int(input('Digite um número qualquer: ')) if n%2 == 1: print('{} é um número ímpar!'.format(n)) else: print('{} é um número par!'.format(n))
f9416a68be10ff9d9cd5bf26075ca432795411a9
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe020.py
399
3.75
4
print('=='*20) print(' Aluguel de Carros') print('=='*20) dias = float(input('Quantidade de Dias Alugados: ')) km = float(input('Quantidade de km Rodados:')) vldias = dias*60 vlkm = km*0.15 print('O valor aluguel do carro por {:.0f} dias é R${:.2f}.'.format(dias,vldias)) print('O valor referente a {:.2f}km roda...
4d486592b272f67a51312e94c21717e6466ca2e4
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe015a.py
314
3.84375
4
#desafio011 larg = float(input('Largura da Parede: ')) alt = float(input('Altura da Parede: ')) área = larg*alt tinta = área / 2 print('Sua parede tem a dimensão {}x{} e sua área é de {:.2}m².'.format(larg,alt,área)) print('Para pintar a área dessa parede você precisará de {}l de tinta.'.format(tinta))
69e112189b071557ec32abb27fef83312a3b9104
marianohtl/LogicaComPython
/Cousera/exe043.py
554
3.609375
4
# Exercício 1 pt.2 - Primos - Semana 7 ''' def n_primos(y): número = teto = y indice = 0 while indice <= teto: if número%2 == 1 or número == 2: print(número) número = número - 1 indice = indice + 1 n_primos(int(input('Digite um número: ')))''' def n_primo2(y): ...
663d3437ad9137b860568da38d71e96e6c16cbfd
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe022a.py
442
4.03125
4
"""co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Comprimento do cateto adjacente: ')) hi = (co ** 2 + ca ** 2) **(1/2) print('A hipotenusa vaimedir {:.2f}.'.format(hi))""""" #import math from math import hypot co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Comprimento ...
6cad9846462ac6a7aa725031f48f3cb593ed1815
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe042.py
1,559
4.3125
4
#Desafio35 from math import fabs a = int(input('Digite um número que represente uma medida de um dos lados de um triãngulo: ')) b = int(input('Digite a medida referente ao outro lado: ')) c = int(input('Typing the mitters of other side the triangle: ')) n = 0 if fabs(a - b) < c and (a + b) > c: print ('Temos um ...
c6bdb9b8bf726a10edb0ef8ecdc6d7649d77ae24
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe041.py
299
3.875
4
#Desafio034 s = float(input('Digite o valor do salário do funcionário: R$ ')) if s > 1250.00: a = s*1.1 print('Você ganhou um aumento de 10%, seu salário atual é {:.2f}.'.format(a)) else: a=s*1.15 print('Você ganhou um aumento de 15%, seu salário atual é {:.2f}.'.format(a))
bf3bf017e9e292af74f40125f54d4418f7cfb24c
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe018.py
359
3.6875
4
print(' =='*30) print(' LOJA DO ABREU') print(' =='*30) print(' 10% de desconto nos Pagamentos à Vista ') print(' 8% de Juros à Prazo') print(' --'*30) preço = float(input(' Preço do Produto: R$')) vista = preço-(preço*0.1) prazo = preço+(preço*0.08) print(' À vista R${:.2f}\n À p...
be5fc502a12febfdd9a27e3ad679f6e20a2ee9b2
marianohtl/LogicaComPython
/Cousera/exe038.py
3,122
3.640625
4
# SEMANA 6 - Jogo do NIM - COM BUGS def campeonato(): print('**** Rodada 1 ****\n') partida() print('\n**** Rodada 2 ****\n') partida() print('\n**** Rodada 3 ****\n') partida() print('\n*** Final do campeonato! ***\n') placar = 'Placar: Você 0 X 3 Computador' return placar def us...
6ae77e800f7da101d96c5a83580335421ecb71d3
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe029a.py
672
4.0625
4
#Desafio023 # erro com números menores que 1000 num = int(input('Digite um número: ')) n = str(num) print('Analizando o número {} ... '.format(num)) print('Unidade: {}'.format(n[3])) print('Dezena: {}'.format(n[2])) print('Centena: {}'.format(n[1])) print('Milhar: {}'.format(n[0])) nuum = int(input('Digite um número: ...
f0b89b93c7e0764aa70f04e355c6c56291614faf
marianohtl/LogicaComPython
/Cousera/exe018.py
259
3.921875
4
# Soma da Sequência dos Componentes de um Número n = input('Digite um número: ') c = int(len(n)) i = 0 ii = 0 soma = 0 while i < c: num = int(n[ii]) soma = soma + num i = i + 1 ii = ii + 1 print('A soma dos algarismos é {}.'.format(soma))
cf15f124c58463f62adea308835582e0d049873a
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe012.py
173
3.75
4
#desafio008 m = float(input('Diga a medida em metro(s): ')) cm = m*100 ml = m*1000 print('{} metro(s) tem {:.0f} centímetro(s) e {:.0f} milímetro(s).'.format(m,cm,ml))
794dc6aa1dea56f555cd942998bacf110dc1a943
marianohtl/LogicaComPython
/Cousera/exe024.py
224
3.90625
4
#Números ímpares Com While n = int(input('Digite o valor de n: ')) i = n*2 ii = 0 while i != 0: if ii % 2 == 1: print(ii) ii = ii + 1 i = i - 1 else: i = i - 1 ii = ii + 1
d1f20334f850800812350de952f64030b53f0aa7
marianohtl/LogicaComPython
/CV Python - Mundo 1/exe023a.py
657
4.09375
4
import math ângulo = float(input('Digite o angulo que você deseja: ')) seno = math.sin(math.radians(ângulo)) # converte o ângulo digitado para radianos e calcula o seno print('O ângulo de {} tem o SENO de {:.2f}.'.format(ângulo,seno)) cosseno = math.cos(math.radians(ângulo)) # converte o ângulo digitado para radianos ...
4b7d62499b73ce7ac264c1dc21660bccef757d4d
xm6264jz/lab-4-assignment-Capstone
/test_camelcase.py
1,055
3.828125
4
import camelCase from unittest import TestCase class TestCamelCase(TestCase): def test_camel_case_sentence(self): self.assertEqual('helloWorld', camelCase.camel_case('Hello World')) def test_emptystring(self): self.assertEqual("Please enter something. No empty string allowed", camelCa...
db0edb58cbd19a318e94c7e33cccab7ba8de9174
sophiaboisvert/C_in_UNIX_Environment
/guessingGame
768
3.71875
4
#! /user/bin/python import random import sys import os #random integer function def randomGen(min, max): return random.randint(min,max) #get username from player username = raw_input("Enter your username: ") #generate random number num = randomGen(-100,100) score = 1 limit = 7 print("You can guess 7 times") #pla...
8af76392fb8ade32aa16f998867a9312303cd2fa
porigonop/code_v2
/linear_solving/Complex.py
2,070
4.375
4
#!/usr/bin/env python3 class Complex: """ this class represent the complex number """ def __init__(self, Re, Im): """the numer is initiate with a string as "3+5i" """ try: self.Re = float(Re) self.Im = float(Im) except: raise TypeError("please enter a correct number") def __str__(self): """ a...
b7a522d63a5e42ecbb016d21a81b76a879fced78
porigonop/code_v2
/theorie_des_graphes/Aventurier_du_rail/graphTrans.py
13,653
4.3125
4
#!/usr/bin/env python3 from BooleanMatrix import BooleanMatrix class GraphTrans: """This class is a new type for describing the graphs """ def __init__(self): """this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node ...
02aa0fb0079ed0857df0b2f9067e27629d3684b3
porigonop/code_v2
/perso/smartrocket/refactor/Obstacle.py
764
3.703125
4
class Obstacle(): def __init__(self, posx, posy, height, width): self.posx = posx self.posy = posy self.height = height self.width = width def collide(self, rocketpos): # rocket is left to the obstacle if self.posx > rocketpos[0]: return False ...
5c5ae6a5a3b41516182b09b03c36fe8636dbebf7
porigonop/code_v2
/theorie_des_graphes/TP2/FiniteStateMachine.py
2,199
3.578125
4
#!/usr/bin/env python3 from Graph import Graph #note : I set the lenght of the tab to 2 cause of some hard condition # in the code, it allow to see all the code. class FiniteStateMachine(Graph): def __init__(self): """ init the Machine with her attribute and the one from Graph """ Graph.__init__(self) s...
77fe588495a88dc03c0d72ce03ea4447ffe56530
porigonop/code_v2
/IA/Virus/Tree.py
1,419
3.9375
4
""" contain the tree object """ class Tree(object): """ define the tree object with value and sons """ def __init__(self, value=None): self.sons = [] self.value = value self.position = None def add(self, tree): """ add a son to the tree """ se...
1d25d661a8799bd4829b14b2aea1ab031dc75682
jiyuankai/algorithms
/backtrack/subset.py
779
3.6875
4
import copy result = [] def subsets(nums): track = [] backtrack(track, 0, nums) return result def backtrack(track, start, choices): # 与全排列不同,子序列的解为递归过程中所有的路径集合(不论是否满足结束条件) result.append(track) # 结束条件choices为空,递归基 if start == len(choices): return for i, choice in enumerate(ch...
f46ad294349b18d7f3fc9b17282dada936ba4864
anamariagds/listas_remoto
/semana10/acessosenha.py
522
3.78125
4
def verifica(dados): tent= 0 while tent <3: tent +=1 nome= input('Usuário ').lower() senha= input('password ').lower() if nome in dados and senha == dados[nome]: print('Bem Vinda, Programadora!') break else: print(f'Senha ou us...
24bb10282f3ed65370060c11e21520d59799a8e5
anamariagds/listas_remoto
/repeticoes/lanches.py
928
3.734375
4
def lanche(): conta = 0 while True: codigo = input(''' CÓDIGO PRODUTO PREÇO (R$) H Hamburger 5,50 C Cheeseburger 6,80 M Misto Quente 4,50 A Americano 7,00 Q Queijo Prato 4,00 X PARA TOTAL DA CONTA''').upper()[0] if codigo ==...
45f0fcb733b310eeae573f6846d3841f3ab4fb20
anamariagds/listas_remoto
/semana7/populacaoAB.py
576
3.765625
4
def maior_populacao(): t = 0 pop_A = float(input("População A: ")) pop_B = float(input("População B: ")) maior = pop_A menor = pop_B if pop_B > maior: maior = pop_B if pop_A<menor: menor = pop_A while maior>menor: t +=1 maior *=1.02 menor *=1.0...