blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
a56dd25e5986d8fab3ff3bd4aa62c917ce947b02
ShreyanshJainJ/dunzo-coffee-machine
/coffee_machine/services/drink.py
1,157
3.84375
4
from dataclasses import dataclass from typing import Dict, List @dataclass class Beverages: """Dataclass for different beverages Returns: [type]: [description] """ drinks: Dict[str, Dict[str, int]] def get_receipe(self, drink_type: str) -> Dict[str, int]: """This method gets the ...
f279ea39e1c7a20cc3ab57ba6177463c89cf1072
BRPawanKumarIyengar/Matplotlib_Module_Tutorial
/Bar_Graph_Example.py
580
4.40625
4
#This is most basic and simplesr ,use of matplotlib #W import matplotlib as my_plt for easy reference from matplotlib import pyplot as my_plt #Here we are manually feeding data for x and Y a #my_plt.plot([1,2,3,4,5],[1,3,5,7,9],) #Here we add lables (that tell us what are values of X and Y ) to x and y axi...
46cce42fb532f74c8a2ff5a36bf9a5940838a95d
sh05git/address_search_APP
/test_address_seacher.py
1,090
3.71875
4
import unittest from address_seacher import AddressSeacher class TestAddressSeacher(unittest.TestCase): def test_岩手県八幡平市大更の地名を郵便番号から取得できる(self): address_sercher = AddressSeacher() actual = address_sercher.search(postal_code="0287111") self.assertEqual("岩手県八幡平市大更", actual) def test_...
27cf2ac960a447bffba4fae886c09be7024003f2
jigarshah2811/Python-Programming
/Interviews/Roblox/Find-Peak-Element.py
1,317
3.5
4
class Solution: def findPeakElement(self, nums: List[int]) -> int: # Edge cases N = len(nums) if N <= 1: return 0 # The element at index 0 is peak! # Since we'r checking mid+1 and mid-1 in our solution, we have to cover 0th and N-1th position if nums[0...
de60feccc4c4ebbe77b29557d5cf3b3b35d69d20
coc0dev/w2d2-exercise
/exercise1.py
1,924
4.34375
4
# Exercise 1 # ------------ # Takes Input # Stores input into a list # user can add or delete items # user can see current shopping list # loops until user 'quits' # after quitting bring out all items in cart def shopping_cart(): print(""" ____________________\n WELCOME TO THE SHOP! ____________________\n""") ...
a43d3cd715fdf9f7dabf136669022a38da504fc3
jjc521/E-book-Collection
/Python/Python编程实践gwpy2-code/code/alg/sort_then_find3.py
556
4.15625
4
def find_two_smallest(L): """ (list of float) -> tuple of (int, int) Return a tuple of the indices of the two smallest values in list L. >>> find_two_smallest([809, 834, 477, 478, 307, 122, 96, 102, 324, 476]) (6, 7) """ # Get a sorted copy of the list so that the two smallest items are at th...
d6eea6c5bb11d1b9c2be3c3c5d56bdfad044054a
togarobaja/Togar-Obaja-Nainggolan_I0320103_Tiffany-Bella-Nagari_Tugas-6
/Exercise 6.13.py
193
3.71875
4
def tambah (a,b): c = a + b return c x = int(input("masukkan bilangan ke 1:")) y = int(input("masukkan bilangan ke 2:")) hasil = tambah(x,y) print("%d + %d = %d" % (x,y, hasil))
3359142fb4f507dbaf6cfe48099363e945fcb822
Snikers1/repo
/Python/lesson_5/Task3.py
979
3.59375
4
#Создать текстовый файл (не программно), построчно записать фамилии сотрудников # и величину их окладов. # Определить, кто из сотрудников имеет оклад менее 20 тыс., # вывести фамилии этих сотрудников. # Выполнить подсчет средней величины дохода сотрудников. employees = dict() with open('Salaries.txt', 'r', encoding='...
251f78cf2d48f24f1d820b0774c5eceeaee46ee8
gjwlsdnr0115/algorithm-study
/pre-warmup/8.math1/math1_02.py
221
3.515625
4
n = int(input()) if n==1: print(1) else: count = 2 current = 7 while True: if current >= n: break else: current += (count*6) count += 1 print(count)
a29b8b0d5617a5897139141d71c02aa0fd8215dd
GuillermoLopezJr/Project-Euler
/Euler-015/Euler015.py
879
3.953125
4
#dynamic programming solution #answer: 137846528820 def printGrid(grid): for row in grid: for elt in row: print(elt, end=" ") print("\n") def getPaths(grid, startx, starty, goalx, goaly): if startx == goalx and starty == goaly: return 1 if (startx > goalx or starty > goaly): return 0 #look up if grid[...
025f51f655d4901d06b237f5cd738298ac53b0d1
Meeshbhoombah/makeschool
/CS3/source/search.py
2,600
4.28125
4
#!python def linear_search(array, item): """return the first index of item in array or None if item is not found""" # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests #return linear_search_iterative(array, ...
62a570e3ee8b1f00ea4c8944d42885b0f3bfc3cd
Ulfatin/PyMath
/PyMath/sqroot1.py
253
4.21875
4
# Program to read a number at run time and find its square root and ceiling value using math library functions. import math print("Program to calculate the Square root and absolute Value") num=121.56 print(math.sqrt(num)) print(math.ceil(num))
842c5df68edda8658ba4d8d5279059ab3e8e6e2b
Anirban2404/LeetCodePractice
/neigh.py
1,882
3.75
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 20 17:41:50 2019 @author: anirban-mac """ """ https://www.interviewbit.com/problems/neigh/ In real world horses neigh, and you can count them by listening to them. For this problem you will be given an input string consisting of lowercases letters...
7a28acff2dc11e884ffe29b28e951f8b1292640d
CiyoMa/leetcode
/validParentheses.py
503
3.96875
4
class Solution: # @return a boolean def isValid(self, s): stack = [] for char in s: if char in ['(', '[', '{']: stack.append(char) else: if len(stack) == 0: return False left = stack.pop() if left == '{' and char == '}' or left =...
d3840e8d57d64cbed77d292c699a2d095b5a8b4d
LuisEnriqueCM/TestingSistemas
/ene-jun-2021/Luis Enrique Cazares Martinez/practicas/Practica 3/Triangulo_Test.py
665
3.625
4
import unittest import Triangulos class TestTriangulo(unittest.TestCase): def test_tipo(self): test_casos=[(1,2,3,"No es un Triangulo"), (4,4,4,"Es un Triangulo Equilatero"), (4,4,5,"Es un Triangulo Isoceles"), (4,3,6,"Es un Triangulo Escaleno"), ...
26619a19c53f4e9fc814cb3e2ac570bf70aa2e5f
dannko97/python_github
/麦叔-博客系统/learn_flask/init_db.py
659
3.5625
4
import sqlite3 # 创建数据库链接 connection = sqlite3.connect('database.db') # 执行db.sql中的SQL语句 with open('db.sql') as f: connection.executescript(f.read()) # 创建一个执行句柄,用来执行后面的语句 cur = connection.cursor() # 插入两条文章 cur.execute("INSERT INTO posts (title, content) VALUES (?, ?)", ('学习Flask1', '跟麦叔学习flask第一部分') ...
56fd54e89964d46c1fc747655476597a3e8ae417
EvaOEva/python1
/10-逻辑运算符.py
433
3.8125
4
# 逻辑运算符: and, or, not score = 90 # and 表示左右两边条件都成立才会执行if语句 if score >= 90 and score <= 100: print("优秀") num1 = 1 # or 表示左右两边条件有一个条件成立就执行if语句 if num1 == 1 or num1 == 2: print("这个数字是我需要的") # not: 对结果进行取反, not对False 取反就True,对True就是False if not 1 == 2: print("条件成立执行")
008c269b078d05ac7eb6b3aa6cf2847bb5498de1
mothebad/mothebads-epicness
/play.py
582
3.8125
4
import random def clear(): print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") def printc(text): clear() print(text) printc("Hello!") input() printc("...
518a37ea7bc3b6815efc423fdb4cde7776d2db03
sandhya563/function_question
/calculator.py
542
3.84375
4
# # question no 6 ka part one # def my_fun(x,y,sign): # if sign=="+": # return (x+y) # elif sign=="-": # return (x-y) # elif sign=="*": # return (x*y) # elif sign=="/": # return (x/y) # x=int(input("no==")) # y=int(input("2 no==")) # sign=input("enter the sign") # print(my_fun(x,y,sign)) def l...
486160b2ec8f83fd9ffbe271f14d3e8632d77085
AzinT/SpotGenius
/SpotGenius.py
2,425
3.5625
4
import sys, requests from bs4 import BeautifulSoup import json def currentSong(): url = "https://api.spotify.com/v1/me/player/currently-playing" payload = {} headers = { 'Authorization': 'YOUR SPOTIFY OAUTH TOKEN' } response = requests.request("GET", url, headers=headers, data = payload) respno...
2997ffb3af5a076ef8159a6b1a75a979eeb1a128
py2-10-2017/MatthewKim
/Fundamentals/DictInTupOut.py
488
3.71875
4
# function input my_dict = { "Speros": "(555) 555-5555", "Michael": "(999) 999-9999", "Jay": "(777) 777-7777" } #function output [("Speros", "(555) 555-5555"), ("Michael", "(999) 999-9999"), ("Jay", "(777) 777-7777")] def tupleit(my_dict): new_tuple=() keycount=0 for key,data in my_dict.items(): ...
4066a5d7de06cb38cfff3372be1e475076ada1ec
NathanRomero2005/Exercicios-Resolvidos-de-Python
/ex.008.py
895
4.25
4
# 8. Escreva um programa que leia um valor em metros e o exiba convertido em km, hm, dam, dm, cm, mm: m = float(input('Digite um valor em metros: ')) km = m / 1000 hm = m / 100 dam = m / 10 dm = m * 10 cm = m * 100 mm = m * 1000 print('{}{}{}, em metros, equivale a {}{}{} Km;'.format('\033[33m', m, '\033[m', ...
bf1d1dd16d93790ee8c6160b8b70f71e5a1dfc61
ktyu/Algorithm_Practice
/Practice_BasicAlgorithms.py
2,351
3.890625
4
# -*- coding: utf-8 -*- import copy # 맨 뒤에 큰 숫자들이 차례로 간다 def bubbleSort(raw_arr): arr = copy.deepcopy(raw_arr) for i in range(len(arr)-1): for j in range(len(arr)-1-i): if arr[j] > arr[j+1]: temp = arr[j] arr[j] = arr[j+1] arr[j+1] = tem...
8a3e40c06cdc3e525ec9c88c9cfd0bf81c0771fc
gubenkoved/daily-coding-problem
/python/dcp_331_flip_count.py
1,667
4.125
4
# This problem was asked by LinkedIn. # You are given a string consisting of the letters x and y, such as xyxxxyxyy. In addition, # you have an operation called flip, which changes a single x to y or vice versa. # Determine how many times you would need to apply this operation to ensure that all x's come # before all...
e8ba9334988f01e7e92b4f1246633f6a388a4e90
kolyasalubov/Lv-627.PythonProject
/Tasks/task_088v.py
432
3.765625
4
from task import Task def _task(n: int) -> int: """ Given a natural number n, swap first and last digits of this number """ n = str(n) answer = f"{n[-1]}{n[1:-1]}{n[0]}" if len(n) > 1 else n return int(answer) task_088v = Task( name="task_088v", body=_task, description=""" Gi...
7f51d41e9a5d82f93a1965460f29e02df2316caa
singultek/ModelAndLanguagesForBioInformatics
/Python/List/3.sublist.py
1,876
4.0625
4
from typing import List, Any def ascending(list): for i in range(len(list)-1): if list[i] < list[i+1]: return True return False def subset(list1: List, list2: List) -> bool: """ Check if all the element of list1 are inside list2, preserving only the order :param list1: li...
54d92ea57071a75db6057d43917832946ea9a963
pisskidney/leetcode
/medium/109.py
2,196
3.859375
4
""" 109. Convert Sorted List to Binary Search Tree https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ """ from typing import Optional # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def __str__(s...
214c264c2f75facb9ef37af98af9d8a67cd8d932
saabii/HW-lession-03
/ex4.2.py
224
3.71875
4
invitation = input('Dear ') l = invitation.split(' ') male = 'mr' female = ['mrs', 'miss', 'ms'] if l[0].lower() in female: print('Female') elif l[0].lower() in male: print('Male') else: print('Error')
195b259035c4e9d3b9b885fcad089c04372f557d
Nubstein/Python-exercises
/Condicionais e Loop/Ex8.py
497
4.125
4
#Faça um Programa que pergunte em que turno você estuda. Peça para digitar M-matutino ou V-Vespertino ou N- Noturno. #mensagem "Bom Dia!", "Boa Tarde!" ou "Boa Noite!" ou "Valor Inválido!", conforme o caso. x=input("Qual turno você estuda? ") x=x.upper() if x=="MATUTINO" or x=="MANHÃ" or x=="M": print("Bom dia!"...
588bc43c54559574a023c1a204d40fb3f902f1b9
KiruthikaaaPandiyann/pythonprograms
/alpha.py
100
3.765625
4
str=input() s=str.lower() l=ord(s) if(l>=97 and l<=122): print("Alphabet") else: print("No")
8906c665b26dce526e3e2639e9ece06ed45ee57d
DiogoM14/Python-Exercicios
/PythonTeste/aula13.py
502
3.890625
4
for c in range(7, 0, -1): print(c) print('FIM') for c in range(0, 7, 2): print(c) print('FIM') n = int(input('Escreva um número: ')) for c in range (0, n+1): print(c) print('FIM') i = int(input('INICIO: ')) s = int(input('SALTO: ')) f = int(input('FIM: ')) for c in range(i, f+1,...
6e17aaaa30f3c40ded66ebecbd51951b1a5b7790
abhishekkrm/Projects
/OS/MP1/q10-speeddate.py
1,892
3.90625
4
from threading import Thread, Lock import time, random # This problem models a speed dating application. A matchmaker thread will # repeatedly select two eligible bachelors and then let them meet for a few # minutes to see if they have chemistry. # # A bachelor can only participate in one date at a time. # # Modify t...
18b71b68467927cfbdd0b8681e9ad66adfc6c5a7
Honichstulle/PythonStuff
/hangman.py
1,363
3.6875
4
import random #Funktion die prüft ob der eingegebene Buchstabe im Wort vorhanden ist def check_letter(wd,wl,array): wrong = 0 strike = 0 counter = 0 guess_array = array while strike < 11: guess = input("Rate einen Buchstaben: ") for i in wd: if guess == i: counter = counter + 1 ...
fcab4d319bd5c691c73777b74ed8b02fff77d02b
Blinkinlabs/BlinkyTape_Python
/binary_clock.py
1,675
3.703125
4
"""Binary clock example using BlinkyTape.py Displays UNIX epoch time using 32 LEDs (white), localtime hours using 6 LEDs (red), localtime minutes using 6 LEDs (green), localtime seconds using 6 LEDs (blue) """ from blinkytape import BlinkyTape import time from datetime import datetime, timedelta import optparse ...
8b77669a6a88de5396d39d7a6e0122a2f6b42b4d
jen8/Object-Oriented-Apps
/pack_geometry.py
234
3.765625
4
import tkinter as tk # import library root = tk.Tk() # create window label1 = tk.Label(root, text="BANANA") # create label button1 = tk.Button(root, text="Button!") label1.pack() button1.pack() root.mainloop() # keep window open
e70e0c9ea3b7d356abc0e60fb23bdc1c30b295a5
CapCorrector/uscs-classes
/python/assign2/mult_table.py
420
3.65625
4
def table_loop(): pass res = [] for x in range(1, 10): res.append([]) for y in range(1, x+1): res[x-1].append((str(y) + ' * ' + str(x) + ' = ' + str(x*y))) print(' '.join((res[x-1]))) def table_comp(): resc = [[str(y) + ' * ' + str(x) + ' = ' + str(x*y) for y in range(1, x+1)] for x in range(1,10)] for x...
5fb8504c82b64c0225263623164ecab0f42d9cc1
markbeutnagel/word-search-trie
/search.py
6,366
3.5625
4
#!/usr/bin/python3 import argparse import pdb help_msg = ''' Given two files: (1) a rectagular letter grid (i.e. word-search puzzle), and (2) a list of words, one per line Print each word with one or more "origins", or "False" if not found. Each word origin is {row}_{column}_{direction}, e.g. "12_5_UL", where "UL...
c87fb4cffb1acf37da7fd32327af3f0f868bf403
dailycodemode/dailyprogrammer
/Python/022_appendMissingCharacters.py
1,021
4
4
# # https://www.reddit.com/r/dailyprogrammer/comments/qr0hg/3102012_challenge_22_easy/ # list1, list2 = ["a","b","c",1,4,], ["a", "x", 34, "4"] # # # MINE # def append_list(list1, list2): # for c in list2: # if c not in list1: list1.append(c) # return list1 # # # # ANSWER by idliketobeapython # def appe...
1c43def9b024a492a436c5b00c359d612f235ab8
hpoleselo/effectivenotations
/effectivepython.py
9,224
4.03125
4
import collections import argparse print(" ") print("-------- Book Notes from Effective Python --------") print(" ") print("Chapter 2: Methods and Functions, give number 2 as input.") print("Chapter 3: Classes, give number 3 as input.") print(" ") chapter = input("Which chapter do you want to run? ") if chapter == ...
78a6d536d99e93687260ae6b922f857efafbe0a7
Hyacinthe04/password
/password.py
1,157
3.765625
4
class User: """ Class that generates new instances of contacts. """ user_list = [] # Empty user list def __init__(self,username,password): # docstring removed for simplicity self.username = username self.password = password user_list = [] # Empty contact li...
16f01a8235ab764e57c56da1f30a6f83642495ea
MAHESHRAMISETTI/My-python-files
/exception.py
395
3.890625
4
# while 1: # a=int(input('enter a num in numerator')) # b=int(input('enter a num in denominator')) # try: # c=(a/b) # except ZeroDivisionError: # print('there is zero in denominator') # else: # print(c) # finally: # print('the code has been executed') #raise try: a=5 print(a) raise NameError('hi b...
5dae640ac1e42fd132d379a98c08ac44bfdd996b
ZaidanNur/PojectProjectan
/Knapsack/knap.py
1,409
3.65625
4
weight =[3,1,2,2,2] price = [100,100,150,180,250] capacity = 3 table = [[0 for col in range(capacity+1)] for row in range(len(weight)+1)] for row in range(len(weight)+1): for col in range(capacity+1): if row == 0 or col==0: table[row][col]=0 elif weight[row-1] <= col: ...
43cdcc4641af6f80bf1abfc4ccdd41fec09e1179
NallamilliRageswari/Python
/VC_Count.py
377
3.515625
4
''' vowel & Constants Count and both multiplied gives result. Input: 2 abcdefg scdegh Output: 2 5 10 1 5 5 ''' n=int(input()) for _ in range(n): s=input() c=0 v=0 for j in s: if('a'==j or 'e'==j or 'i'==j or 'o'==j or 'u'==j): v+=1 else: ...
e2af2297021ebc769b4e56b93325ad965b744633
KristianMSchmidt/Fundamentals-of-computing--Rice-University-
/Interactive Programming/Andet/circle_timer.py
585
3.96875
4
# Expanding circle by timer ################################################### # Student should add code where relevant to the following. import simplegui WIDTH = 1000 HEIGHT = 1000 radius = 1 # Timer handler def tick(): global radius radius=radius+1 # Draw handler def draw_handler(canvas): canvas.d...
fb2b58a0e656e0095ee33678a3158fe008e07f66
wls-admin/entrepot
/demo13.py
119
3.578125
4
b=0 h=0 while True: b=b+1 h+=3 if h==20: print("一共跳了",b,"天") break h -= 2
48208736b15af7a2c6c0bcf0a62a680f7ed974a3
crystalbai/Algorithm
/problems/quicksort.py
1,052
3.8125
4
import random import sys def quick_sort(nums, s,e): if s <e: pivot = part(nums, s,e) quick_sort(nums,s, pivot-1) quick_sort(nums, pivot+1, e) def part(nums, s,e): idx = random.randint(s, e) nums[idx], nums[s] = nums[s], nums[idx] pivot = nums[s] small = s for i in range...
b431d4149d6101e062734e8f71a6fece6122fc63
keveleigh/espn-sftc
/props.py
4,060
3.5
4
#!/usr/bin/env python """ This scrapes Streak for the Cash information from ESPN and writes it to an Excel spreadsheet. It uses BeautifulSoup 4 and xlsxwriter. In order to use this, you will need to download bs4, lxml, and xlsxwriter. Prop array format: [Sport, League, Prop, Active Picks %, Winner, Winner %, Loser, ...
709bc3cba968663cf9a15e3958b1f2fbd67f172c
blaurensayshi/Curso_Topicos_Programacao_Python
/Aula3/Exercício 1.1.py
376
4.03125
4
""" Número de Fibonacci Fn = Fn-1 + Fn-2 F0 = 0 ; F1 = 1 """ def Fibonacci(numero): if numero == 0: return 0 if numero == 1: return 1 else: return Fibonacci (numero - 1) + Fibonacci (numero - 2) x = int(input("Digite um número para calcular: ")) res = Fibonacci(x) y = 0 while F...
8f0b1a2ec5d31b3a74f450e449629bbe845248fb
lessunc/python-guanabara
/task075.py
1,107
4.0625
4
#coding: utf-8 #-------------------------------------------------------------------------- # Um programa que recebe 4 números em uma tupla e retorna: # • Quantos números 9| • Posição do 1º número 3|• Quais os números pares| #-------------------------------------------------------------------------- # Maior e menor ...
886b4ab1aea95167d41fec8e3f07c04235cb41d6
blankd/hacker-rank
/python/src/blankd/hackerrank/python/collections/counter.py
904
3.578125
4
from collections import Counter from blankd.hackerrank.main.hacker_rank_solution import HackerRankSolution # Solution for https://www.hackerrank.com/challenges/collections-counter/problem class CounterSolution(HackerRankSolution): def __init__(self, file_to_read): super().__init__(file_to_read) l...
485dbd9c4ba0c62ff186237181bbb8473298aced
mamine2/My-First-Repository
/personality_MA.py
791
3.765625
4
name = "cus" state = "colorado" city = "New York City" game = "BF1" book = "martian" print(name + " likes to visit " + state + " and " + city) print("he also likes pwning on " + game + " or reading " + book) print("whats your favorite s00bJ") subject = input() if subject == "quick mafs": print("schw...
cbcbb03a13e3ad26c0462f3d1727a1e89984e829
modmeister/codesignal
/avoidObstacles.py3
280
3.515625
4
def avoidObstacles(inputArray): range = 2 inputArray.sort() position = range while (position <= inputArray[-1]): if position in inputArray: range += 1 position = range continue position += range return range
ddbf32f53d5f7e4bab6147cc7e1f03282b24d5c4
mrdonliu/Classification
/LogisticRegression.py
11,404
4.03125
4
import os import pickle import numpy as np from scipy import optimize from sklearn import datasets """ a dataset of features(X) or targets(Y), or theta(theta), are all represented as column vectors example: features = [ [ 2 , 3 , 5] [ 3 , 4 , 8] ] We have three datasets, each with two featu...
f94d0dac682c14560f90a180e55f7a9f2712d8be
HelalChow/Data-Structures
/Homework/HW2/hc2324_hw2_q7.py
607
3.609375
4
def findChange(lst01): left = 0 right = len(lst01)-1 one = None index_found = False while(index_found==False): curr = (left+right)//2 if lst01[curr]==0 and lst01[curr+1]==1: one = curr+1 index_found=True elif lst01[curr]==0 and lst01[curr+1]!...
28689ae1dafa864ac6e8700f569a0736e97aa93d
erickcarvalho1/ifpi-ads-algoritmos2020
/Fabio02_P01/F2_P1_Q4_DEZENAIGUALUNIDADE.py
336
3.859375
4
#Leia 1 (um) número de 2 (dois) dígitos, verifique e escreva se o algarismo da dezena é igual # ou diferente do algarismo da unidade. numero = int(input('Qual o número de dois digitos? ')) dezena = numero // 10 unidade = numero % 10 if dezena == unidade: print('São iguais') else: print('Não são i...
488e24d974de43c1d0be6bf28096450fee826fe6
samutrujillo/holbertonschool-higher_level_programming
/0x03-python-data_structures/9-max_integer.py
200
3.515625
4
#!/usr/bin/python3 def max_integer(my_list=[]): if len(my_list) == 0: return None count = my_list[0] for i in my_list: if i > count: count = i return count
ea9407fb750b96e24653a10183418ebf8aeb6808
tqphuc567/Word2vec
/Tich 2 ma tran.py
642
4.21875
4
# -*- coding: utf-8 -*- """ Created on Tue Oct 8 02:55:05 2019 @author: Phuc123 """ # Program to multiply two matrices using nested loops # 4x3 matrix X = [[1,0,1], [1 ,0,0], [1 ,0,0], [1,1,0]] # 3x3 matrix Y = [[5,5,5], [5,5,5], [5,5,5]] # result is 4x3 result = [[0,0,0], ...
3524655e414cb089f1cc3f258a5633f02332ec9e
estebantoso/curso_python_udemy
/34 - lists_comprehension.py
357
3.65625
4
nums = [1, 2, 3] print([x*10 for x in nums]) print([x/2 for x in nums]) name = "colt" print([char.upper() for char in name]) generic_list = ["", 0, [], 1] bool_list = [bool(val) for val in generic_list] print(bool_list) colors = ["orange", "yellow", "green", "blue", "red"] colors = [color[0].upper() + color[1:]...
7770c877ba29d2e6e8228df1abf6a7e8b61fa0ad
ajcepeda/Calculator
/test_12.1.py
2,632
3.78125
4
import unittest from exercise import Subject, Student class Test(unittest.TestCase): def test_subject(self): name = "Math" units = 1.5 grade = 87.2 s = Subject(name, units, grade) self.assertEqual(s.name, name) def test_subject_with_error_name(self): name = ""...
d961a8a00bd53f6e74321eb68bdacfc340e3d418
mayukhrooj/Hackerrank
/chipher.py
823
4.0625
4
#!/usr/bin/env python3 def lower_en(char,k): ascii_char = ord(char) ascii_char += k % 26 if not ascii_char <= 122: distance = ascii_char - 122 position = 97 + (distance - 1) return chr(position) else: return chr(ascii_char) def upper_en(char,k): ascii_char = ord(cha...
b267c8f5a1de4dc17c958285e484704a7ee47eb9
jayg791/CA4_JamesGallagher_10028426
/Github_Commit Changes_Script.py
1,995
3.5625
4
# -*- coding: utf-8 -*- """ Created on Fri May 05 16:57:05 2017 @author: EliteBook """ # Github_Commit Changes_Script.py # code to open the file, read the lines and strip the spaces fhandle = open('Github Data.txt', 'r') data = [line.strip() for line in open('Github Data.txt', 'r')] # a variable to handle the txt s...
a7024c68b0e96c24c8dbcbd6fa4cbbc490525328
mikebuss42/Dragon_Cave
/dragon.py
3,370
4.25
4
import random import time '''===================Functions===================''' def display_intro(): print('''\n***** You are in a land full of dragons! ***** You set out in search for treasure, guarded by a dragon. As you set forth on your adventure, you come to a mountain side. In front of you, you...
f96b745263e49d44f1852a38c1a49609f1d74ed3
AncauAdrian/FundamentalsOfProgramming
/Homework/Week1/P3.py
813
3.640625
4
#Problem 3 n = int(input("Enter the number: ")) def formlist(n): #This fuction takes the number n, splits it into seperate digits and forms a sorted list comprised of those digits l = [] while n != 0: x = n% 10 l.append(x) n = int(n / 10) l.sort() return l def formnumber(x):...
069b6941256630b0dbd815fb3e1611eba62edbd5
joannalew/CTCI
/Python/dp-coin-change.py
1,891
4.09375
4
# LeetCode 322: Coin Change # You are given coins of different denominations # and a total amount of money amount. # Write a function to compute the fewest number of coins that # you need to make up that amount. # If that amount of money cannot be made up by any combination # of the coins, return -1. # Exam...
647801beaed1a1b0a9221dd96f8dc85bb7cfa00c
jayasri22/python
/leap.py
216
4.09375
4
y = int(input("Enter y: ")) if y % 4 == 0 and y % 100 != 0: print(y, "Leap Year") elif y % 100 == 0: print(y, " not Leap Year") elif y % 400 ==0: print(y, "Leap Year") else: print(y, "not Leap Year")
c51f75a63c6baaea19868113d81c96fc8bc19e09
alexandros-antonorsi/high-school-code
/Python/largebrowncow.py
476
3.5
4
file = open("nocow.in", "r") out = open("nocow.out", "w") line = file.readline().split(" ") n = int(line[0]) k = int(line[1]) line = file.readline() line = (line[(line.find("no")+3):].split(" "))[:-1] adj = [[] for i in range(0, len(line))] for x in range(0, len(line)): adj[x].append(line[x]) for x in range(1, n): ...
0a6286c4c5ebf4ee5f27e5a0978930dc9df1b934
likohank/mianshiti_2020
/10.sort.py
789
3.953125
4
import os,sys def heap_sort(array): def heap_adjust(parent): child = 2 * parent + 1 # left child while child < len(heap): if child + 1 < len(heap): if heap[child + 1] > heap[child]: child += 1 # right child if heap[parent] >= heap[child]...
121ebfb1454499442435975b1d64d6fa1f2a84c0
Demi0619/Alien-Invasion-Game
/bullets.py
664
3.640625
4
import pygame from pygame.sprite import Sprite class Bullets(Sprite): ''' a class to manage bullet fired from ship''' def __init__(self, ai_game): super().__init__() self.screen = ai_game.screen self.settings=ai_game.setting1 self.color=self.settings.bullet_color self.r...
faf9a7e9a4a7b74aa01bd79a93f4227418a5192d
Jigar710/Python_Programs
/numpy/list_intro/l2.py
84
3.625
4
lst = [] for i in range(5): x = input("Enter data : ") lst.append(x) print(lst)
0dd467f6ffe1457ce6bfbf9d6d80707d345150c2
untitledmind/scrape-macys
/macys.py
5,257
3.625
4
"""Macy's web scraper Author: Ethan Brady last updated Jan 16 2020 This script creates a database Macy's products by scraping their online website with BeautifulSoup and the requests module. Because the program makes http requests in a for-loop context, it's rather slow. Note: For speed reasons, the loop curre...
daf995bc4a2df0f84e2e1391d5936355b784fbeb
jorge-alvarado-revata/code_educa
/python/week11/bubble.py
423
3.65625
4
# algoritmo de burbuja import random import time def bubble(lista): for j in range(len(lista)-1, 0, -1): for i in range(j): if lista[i] > lista[i+1]: lista[i], lista[i+1] = lista[i+1], lista[i] N = int(input()) lista = [] for i in range(N): lista.append(random.randint(-10...
efe424671c3abd867038aea633d8e1dcdbcada40
Jorefice27/Voyant
/checkpassword_trie.py
724
4.15625
4
from trie import Trie t = Trie() passwords = open('passwords.txt') for password in passwords: t.add(password.strip()) print('Enter "checkpassword" followed by a password to see if it is a common password') print('Enter "Exit" to quit the program\n') while True: userInput = input('$').strip() if userInput....
540fffab644352f7a3d7a0fd2a9fb94a489f0d69
sdbaronc/taller_de_algoritmos
/algorimo_16.py
152
3.765625
4
t=float(input("ingrese el tiempo en segundos")) a=float(input("ingrese la aceleracion em m/s^2")) vel= t*a print("la velocidad final es de:",vel,"m/s")
001dd4e3991c0ff2377d437e1eacb5b17f0e974e
Ackermannn/PythonBase
/PythonBase/python基础/丰富的else语句.py
582
3.640625
4
#=====while 与 else 的配合 def showMaxFactor(num): count = num // 2 while count > 1: if num % count == 0: print('%d最大的约数是%d' % (num,count)) break # 如果没有break 就跑else count -= 1 else: print('%d是素数!' % num) num = int(input('请输入一个数:')) showMaxFactor(num) # try 可以...
0f80bd77bf4afa6175db6c79a133db869bca2f64
jobalouk/clean-code-notes
/playground.py
353
3.578125
4
def main(): some_record = {'name': 'John'} employee = CommissionedEmployee(record=some_record) employee.is_payday() class Pay: def __init__(self, record): self.record = record def is_payday(self): NotImplementedError class CommissionedEmployee(Pay): def is_payday(self): ...
5cdbc5df0efe1b90c628980ae5e600a5364c2d84
68Duck/Countdown
/checker.py
3,881
3.59375
4
class Checker(object): def __init__(self,startNumber,numbers,path=[],parentWindow=None): self.path = path self.parentWindow = parentWindow self.numbers = numbers self.startNumber = startNumber self.check() def check(self): for number in self.numbers: ...
731f435ae8daa1880a43a0cff541f395c825eb32
carlosmaniero/ascii-engine
/ascii_engine/screen.py
2,565
3.84375
4
""" This module provide the screen representation. A screen is a where all to render elements should stay. """ from ascii_engine.pixel import BLANK_PIXEL from ascii_engine.coord import Coord, CoordinatedElement class Screen: """ This is the screen where elements should be rendered given a coordinate. Y...
27ce397ca344134039439b54680da8a61fe717f4
zizhazhu/leetcode
/exercise/Binary-Search/222.完全二叉树的节点个数.py
1,118
3.609375
4
# # @lc app=leetcode.cn id=222 lang=python3 # # [222] 完全二叉树的节点个数 # # @lc code=start # 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 countNodes(self, ro...
93dc96bc4869f620af03aa0529f129f99fccb05f
heldaolima/Exercicios-CEV-Python
/ex059.py
1,114
4.0625
4
escolha = 0 n1 = float(input('Insira o primeiro valor: ')) n2 = float(input('Insira o segundo valor: ')) while escolha != 5: print('-----------------') print('''Opções: [1] SOMAR [2] MULTIPLICAR [3] DESCOBRIR QUAL É O MAIOR [4] INSERIR NOVOS NÚMEROS [5] SAIR DO PROGRAMA''...
f70b19de43fdfe57e0e84d55c297b9456959711a
JoaoFiorelli/ExerciciosCV
/Ex020.py
239
3.546875
4
import random n1 = input('Aluno um: ') n2 = input('Aluno dois: ') n3 = input('Aluno três: ') n4 = input('Aluno quatro: ') lista = [n1, n2, n3, n4] random.shuffle(lista) print('A ordem de apresentação dos alunos será: ') print(lista)
757ad7a14b628492b3b36620361b6eb11d5c6c49
andresvanegas19/holbertonschool-higher_level_programming
/0x0A-python-inheritance/3-is_kind_of_class.py
289
3.53125
4
#!/usr/bin/python3 """Test if the object is inherent of a class""" def is_kind_of_class(obj, a_class): """function that validated if the object is a instace of a class in python""" try: return isinstance(type(obj), a_class) except TypeError: return False
a32289f4feb1125717c6ced9128ffdae6d9e5fac
ruyixuan/Python
/whiletest.py
217
3.890625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- var = 0 while var < 10: num = input(str(var)+"Enter a number:") var += 1 if num == "fuck": print ("请注意语言文明") break else: print ("超过限制!")
d0ecbd53be6f0dfee826ded405ee07d0535fde55
ankitdbst/Utilities
/ciphers/cipher.py
794
3.734375
4
#!/usr/bin/env python import sys class Cipher: mod = 26 def init(self): pass def encrypt(self): pass def decrypt(self): pass def modexponent(self, base, exp, m): result = 1 while exp > 0: if exp & 1 == 1: result = (result * ba...
90f9f9517b3a378073a865d96b4aaf701fa16d2d
DrMikeG/LegoEcho
/pythonBook/book_examples/chapter_05/5.1.py
511
3.78125
4
from datetime import datetime class Animal(object): """A class representing an arbitrary animal.""" def __init__(self, name): self.name = name def eat(self): pass def go_to_vet(self): pass class Cat(Animal): def meow(self): pass def purr(...
34cb637d5f00ec75016f5a4f86f8a3ad74dd6498
mcmanutom/LCA
/LCAPython/src/LCA.py
1,533
3.640625
4
''' Created on 15 Oct 2020 @author: user ''' # A binary tree node class Node: def __init__(self, key): self.key = key self.left = None self.right = None def findPath( root, path, k): if root is None: return False # Store this node is pa...
a7b609d249b232989bcf46649c8318631ff0acaf
Phlank/ProjectEuler
/python/src/pje_0036.py
1,225
3.671875
4
#returns a list of digits of i def int_to_list(i): list = [int(x) for x in str(i).zfill(1000)] while list[0] == 0: list.remove(0) return list #reverses a list def reverse(l): reverse_list = [] x = len(l)-1 while x >= 0: reverse_list.append(l[x]) x -= 1 return reverse_lis...
2a3ef4bc7eba470e1a2629d56a0cd16167beb08d
samkit5495/data-visualization-matplotlib
/code.py
2,391
3.515625
4
# -------------- import pandas as pd import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') # Load the dataset and create column `year` which stores the year in which match was played df = pd.read_csv(path) df['year'] = df['date'].str[:4] match_data = df.drop_duplicates(subset='match_code',...
0a5c62edddb0b2e944b8f1afa9b084dac368e90f
diogolimas/game-pygame
/game-parte1.py
752
3.71875
4
import pygame pygame.init() #locations variables x = 400 y = 300 velocity = 10 window = pygame.display.set_mode((600,600)) pygame.display.set_caption("Py Game test application") open_window = True while(open_window): pygame.time.delay(50) for event in pygame.event.get(): if event.type == pygame....
7860030c4ed7d870faf7416a348412c27a6e634d
xsr-e/pythonf
/13_tuples.py
132
3.953125
4
box1 = (4,4) box2 = (2,3) box3 = (2,8) boxes = [box1, box2, box3] for b in boxes: x,y = b print ("x:{}, y:{}".format(x,y))
d08e9d97afdcbea0eaa08c218378d72f3da68cab
jiangshen95/UbuntuLeetCode
/HouseRobberIII.py
959
3.5625
4
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def rob(self, root): """ :type root: TreeNode :rtype: int """ def rob(root): if not root: return 0 if r...
aab2f4a15cabff0def52f27cf990fa78e293032e
Crasti/Homework
/Lesson1/Task3.py
312
4.0625
4
"""Узнайте у пользователя число n. Найдите сумму чисел n + nn + nnn. Например, пользователь ввёл число 3. Считаем 3 + 33 + 333 = 369.""" digit = input("Введите число: ") print(int(digit) + int(digit * 2) + int(digit * 3))
ce32718e87d395fe10eb94bfa77cef43e403a097
Starefossen/euler
/problem 7.py
216
3.765625
4
from math import ceil, sqrt primes = [] i = 1 while (len(primes) < 10): isPrime = True for prime in primes: if (i%prime == 0): isPrime = False break if (isPrime): primes.append(i) i += 2 print primes
3456a0f06147b3344aee6baddf14dfdba710e16f
ittoyou/2-1807
/16day/3-生成器.py
233
3.75
4
''' def test(): a,b = 0,1 for i in range(10): a,b = b,a+b yield b t = test() for i in t: print(i) ''' def test(): a,b = 0,1 for i in range(10): a,b = b,a+b yield b t = test() for i in t: print(i)
67c595279a4371ca1d113588f49c4f142b94fbd7
hesham9090/Algorithms
/Insertion_Sort.py
816
4.46875
4
""" Insertion Sort is not fast algorithm because it uses nested loops to sort it can be used only for small data Check below image for more illustration about how insertion sort works https://github.com/hesham9090/Algorithms/blob/master/images/InsertionSort.png """ data = [100,12,90,19,22,8,12] data2 =...
4ce09b5c3934eb0054b71b65998b627db69ae207
Abis47/HH-PA2609-1
/24_LR/4LR.py
3,241
3.65625
4
#Topic: Linear Regression Stock Market Prediction #----------------------------- #libraries import pandas as pd import matplotlib.pyplot as plt Stock_Market = {'Year': [2017,2017,2017, 2017,2017,2017,2017,2017, 2017,2017,2017,2017,2016,2016,2016,2016,2016,2016,2016,2016,2016, 2016,2016,2016], 'Month': [12, 11,10,9,8,...
ec2361923d5e994a210d0c3c612535181f2f6dea
JosephKheir/Bioinformatics
/LoopsAndDecisions/count_kmers.py
644
3.5625
4
#!/usr/bin/env python # count_kmers.py seq = 'GCCGGCCCTCAGACAGGAGTGGTCCTGGATGTGGATG' kmer_length = 6 # Initialize a k-mer dictionar kmer_dictionary = {} # Iterate over the positions for start in range(0, len(seq) - kmer_length): # Get the substring at a specific start and end position kmer = seq[start:start+ k...
759906ca7de02a0523bdcb92493a639027a07bd1
dkumor/rtcbot
/rtcbot/subscriptions.py
8,014
3.5
4
import asyncio import numpy as np from functools import partial import logging from collections import deque class EventSubscription: """ This is a subscription that is fired once - upon the first insert. """ def __init__(self): self.__evt = asyncio.Event() self.__value = None d...
ddb1225cae9bd158c9026e2e50d14c7e302e2376
YunsongZhang/lintcode-python
/VMWare/1357. Path Sum II.py
807
3.734375
4
class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None class Solution: """ @param root: a binary tree @param sum: the sum @return: the scheme """ def pathSum(self, root, target): paths = [] self.dfs(root, [], target, paths...
75d310853bd7f0dc68f2b412e7583b2a4f241053
SSStanislau/CodeWars
/7 kyu/regexp_basics_is_it_a_letter.py
200
3.90625
4
''' Complete the code which should return true if the given object is a single ASCII letter (lower or upper case), false otherwise. ''' def is_letter(s): return s.isalpha() and len(s)==1
edf4de402f1c4539036f227ffec70c3fe8bf6d1c
Chen-Yiyang/Python
/Practical 1/Qn2.py
284
4.40625
4
# Computing the volume of a cylinder # by Yiyang 14/01/18 _radius = float(input("Radius of the cylinder = ")) _length = float(input("Length of the cylinder = ")) _area = (_radius ** 2) * 3.141593 _volume = _area * _length print("Volume of the cylinder = {0:.2f}".format( _volume))