blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
bee651095528b75cabc10603da35740455a85cb4
limapedro2002/PEOO_Python
/Lista_02/Pedro Lucas/exr1.py
1,310
3.5625
4
print ("RESPONDA APENAS COM SIM E NAO") res1 = str(input("Telefonou para a vítima? 1/Sim ou 0/Não: ")) res2 = str(input("Esteve no local do crime? 1/Sim ou 0/Não: ")) res3 = str(input("Mora perto da vítima? 1/Sim ou 0/Não: ")) res4 = str(input("Devia para a vítima? 1/Sim ou 0/Não: ")) res5 = str(input("Já trabalhou com...
074f7381bd494349f59a3e06267dc9157e3426a0
Beatriceeei/introduction_to_algorithm
/chapter10/queue.py
1,336
3.859375
4
class Queue(): def __init__(self, max_size=20): self.max_size = max_size self.data = [-1]*max_size self.head = 0 self.tail = 0 def incre(self, i): if i >= self.max_size - 1: return 0 return i+1 @property def is_empty(self): return sel...
b9523b5037da679547637297dd854d1c2ae387c6
subbiahs84/LearnPython
/MyCode.py
108
3.765625
4
x = input("Enter the 1st Number ") y= input("Enter the 2nd Number ") s=x+y print(s) z=int(x)+int(y) print(z)
0dedbe312006b5991ed7e7aac56a00186d0b1157
ramosemilio/COVIDualizations
/CSV_TOTAL_CASE_CHECKER.py
1,688
3.671875
4
#COVID CSV CHECKER v0.11 #By Emilio Ramos from tkinter import filedialog import tkinter root = tkinter.Tk() root.filename = filedialog.askopenfilename(initialdir = "/", title = "Select file", filetypes = (("csv files","*.csv"),("all files","*.*"))) print (root.filename) #POINT TO JHU .CSV WITH...
e2e5897a1aaf40ace75aeb2a367c059799c62cea
seanchen513/leetcode
/greedy/0435_nonoverlapping_intervals.py
8,968
4.09375
4
""" 435. Non-overlapping Intervals Medium Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Example 1: Input: [[1,2],[2,3],[3,4],[1,3]] Output: 1 Explanation: [1,3] can be removed and the rest of intervals are non-overlapping. ...
09994a52c008293fb3207e79c3075ad1b59d447d
Nana0606/basic-algorithms
/nowcoder/huawei_find_brothers_words.py
946
3.78125
4
# python3 # -*- coding: utf-8 -*- # @Author : lina # @Time : 2019/1/18 10:32 def isBrothers(element, target): if element == target: return False if sorted(element) == sorted(target): return True if __name__ == '__main__': contents = [elem for elem in input().split(' ') if...
6533a61d24d6051c3ac584f574dd9127300879a0
daniel-lee-dl/Advent-2020
/Day 18/Day18.py
4,887
4.03125
4
from __future__ import annotations from typing import List, Tuple class IncorrectMath: def __init__(self, problems): self.problems: List[List[str]] = problems self.answers: List[str] = [] # This function will accept two numbers and an operation ("+" or "*") and will either add or m...
a1d9ef833fc5bd5ec62de4f899345823686f133d
AndreySamolyak/HomeWork.Project
/Lesson5/execrises/flat.py
5,073
3.671875
4
#!/usr/bin/python3 """ Ремонт в квартире Есть квартира (2 комнаты и кухня). В квартире планируется ремонт: нужно поклеить обои, покрасить потолки и положить пол. Подсказка: для округления вверх и вниз используйте: import math math.ceil(4.2) # 5 math.floor(4.2) # 4 Примечание: Для простоты, будем считать, что о...
4030bf1a7625a461153f6afc7dab977e27ab9e55
n-ill/blackjack
/blackjack_pygame.py
7,707
3.5
4
import blackjack import pygame class button(): def __init__(self, color, x, y, width, height, text=''): self.color = color self.x = x self.y = y self.width = width self.height = height self.text = text def draw(self, win, outline=None): # Call this metho...
f616c0692ab2182bbd4b74f6e2748bd09fbbdc45
Rowing0914/TF2_RL
/tf_rl/examples/PETS/test/property_test.py
350
3.6875
4
class Human: def __init__(self, name="Norio"): self.name = name @property def nickname(self): return "_"+self.name+"_" @property def sayName(self): print("Hi {}".format(self.name)) return "Hi {}".format(self.name) if __name__ == "__main__": me = Human() pri...
5f70ce0bcce55c3b28ea31ce48ae0b60d58336c4
maxdubakov/snake-ai
/views/game.py
6,275
3.546875
4
import sys import random import time import pygame as p from config import * class Game: def __init__(self, surface, color1, color2, replaying): self._surface = surface self._color1 = color1 self._color2 = color2 self._replaying = replaying def draw_grid(self): for...
41a2dd5ef69107860ae66b46df40c7ab6f78f9b9
brady-wang/mac_home
/python/sort_test/bubble_sort.py
697
3.84375
4
# *_*coding:utf-8 *_* #对于一个长度为N的数组,我们需要排序 N-1 轮,每 i 轮 要比较 N-i 次。对此我们可以用双重循环语句,外层循环控制循环轮次,内层循环控制每轮的比较次数 def bubble_sort(sort_list,sort='asc'): if len(sort_list) <= 0: return [] count = len(sort_list) sorted_list = sort_list for i in range(0,count-1): print('第%d趟排序:' % (i + 1)) for...
39e095c88e4c0c42a10af0c2cb3bc874b11b322b
hal00alex/Python_Auto_Practice
/defWithCommandLine.py
543
3.75
4
import os import sys def one(): print "Creating file of one type\n" def two(): print "Creating file of two type\n" def three(): print "Creating file of three type\n" def main(): print "Hello Master!\n" #get file type from user fileType = str(sys.argv[1]) if (fileType == "-1"): one() elif (fileTyp...
a1d71faafd68f3f64e54b1a1ef89ce02b533a802
shichao-an/ctci
/chapter9/question9.5.py
1,696
4
4
from __future__ import print_function """ Write a method to compute all permutations of a string """ def get_permutations1(s): """ Append (or prepend) every character to each permutation of the string which does not contain the current character """ if not s: return [''] else: ...
7e1d9a7eb73d8ab179d884089b25365ea472a136
CurtisFord1997/Indian-Hills
/Python/Lab4/BugCollector.py
841
4.28125
4
#Curtis Ford 3/11/2020 #bug catcher program, asks for 7 days of bug catching and accumulates them. def main(): bugs = init bugs = inpt(bugs) outpt(bugs) def init(bugs): bugs = 0 #initilizes bug accumulator print("This program asks you for 7 days of bug catching.") def inpt(bugs): #inalid = T...
0d48679aa1749c17a8376f577a673f1afb68c877
euyag/python-cursoemvideo
/Modulo 01/exercicos/d019.py
293
3.703125
4
print('===== DESAFIO 019 =====') import random n1 = str(input('primeiro aluno: ')) n2 = str(input('segundo aluno: ')) n3 = str(input('terceiro aluno: ')) n4 = str(input('quarto aluno: ')) list_alu = [n1, n2, n3, n4] sorteado = random.choice(list_alu) print(f'o aluno sorteado foi: {sorteado}')
f760869bdcafb22a4dbd912fcc973285f4963f52
barshanayak119/pythonFiles
/input_stops_when_blank.py
91
3.6875
4
#Input stops with non-integer input x=input() while x!="": x = int(x) x = input()
bf94536804868dc3c799d6b0441163db48e97274
sagarnikam123/learnNPractice
/hackerRank/tracks/languages/python/4_sets/12_checkSubset.py
1,743
3.75
4
# Check Subset ####################################################################################################################### # # You are given two sets A and B. # Your job is to find whether set A is a subset of set B. # # If set A is subset of set B, print True. # If set A is not a subset of set B, ...
b8213cc5ab57f8436bbd2352559f64d6f134d295
Wasserratte/waitercaller
/passwordhelper.py
608
3.578125
4
import hashlib import os import base64 class PasswordHelper: def get_hash(self, plain): #For registration a new user. return hashlib.sha512(plain).hexdigest() #sha512 hash for the #final hash we will store. def get_salt(self): return base64.b64encode(os.urandom(20)) #os.urandom create...
188e8b1b7949e776f218de1fe86138e4a969ce80
HelenBai2002Tong/Cesium
/Projects&Assignments/BinaryTree.py
704
3.546875
4
class Tree: def __init__(self,cargo,left=None,right=None): self.cargo=cargo self.left=left self.right=right def pre(k): if k is None: return print(k.cargo,end=" ") pre(k.left) pre(k.right) def inp(k): if k is None: return None inp(k.left) print(k...
6ab2b1d6b0a4e2f78b4397bfe61e94224cefd6a8
jokemaan/web_spider
/re/re01.py
918
4.375
4
# -*- coding:utf-8 -*- #------------------------ # be familiar with the regular expression # a simple re module example used to match 'hello' substring # the using steps: # 1. compile the string form of regular expression to Pattern instance # 2. use the Pattern instance to process the text and get the matching result ...
dc7696590d89dc346fa7a407519c45361c80483c
ArturKow66/python-zookeper
/Topics/Program with numbers/The sum of digits/main.py
76
3.734375
4
number = input() _sum = 0 for i in number: _sum += int(i) print(_sum)
6044f962c9cb1a314bbf5ceddb6c3802463cf427
Kcpf/DesignSoftware
/Lista_alunos_ímpares_.py
350
3.6875
4
""" Escreva uma função que recebe uma lista de nomes de alunos e devolve uma lista contendo somente os alunos nos índices ímpares, dividindo a turma em dois. O nome da sua função deve ser alunos_impares. """ def alunos_impares(lista): l = [] for c in range(len(lista)): if c % 2 != 0: l.append...
5f0d32469ffa9391088cbbe715b209ee3211c466
jngo102/ECE_203_Project
/main.py
10,788
3.78125
4
from Tkinter import * import os import pickle # Class definition for main map class Game: def __init__(self, root): self.root = root self.root.title("Space Exploration") self.canvas = Canvas(self.root, width=1280, height=720) self.canvas.pack() # Booleans that will be toggl...
b813e9973526cd43c67f99d760949d074970bae5
rodrigoacaldas/PeO-IFCE-2020
/acertePreco/acertePrecoHumanoVSMaquina.py
2,076
4
4
from random import randint print("*********************************") print("Bem vindo ao jogo de Adivinhação!") print("*********************************") numero_menor = numero_menor_maquina = 0 numero_maior = numero_maior_maquina = 100 numero_secreto = randint(numero_menor, numero_maior) total_de_tentativas_humana...
dc2b41c5e65762f14e13105818901f36bd49fbad
MartrixG/2020-spring-database
/project1/test.py
744
3.53125
4
import pymysql # 数据库参数 config = { 'host':'localhost', 'port':3306, 'user':'root', 'password':'root', 'database':'lab1', 'charset':'utf8', 'cursorclass':pymysql.cursors.Cursor, } # 连接数据库 db = pymysql.connect(**config) try: with db.cur...
8b7e44d8f57327d8492972c26985292487501aba
Vekteur/plogic
/src/layered_dict.py
2,236
3.515625
4
from abc import ABC, abstractmethod class LayeredDict: class Action(ABC): @abstractmethod def exec(self, d): pass class SetAction(Action): def __init__(self, key, value): self.key, self.value = key, value def exec(self, d): d[self.key] = self.value class PopAction(Action): def __init__(self, key): self.k...
a3e8ff41cbf63e4cbe4a1d16ae909191c2a391fe
cpe202spring2019/lab1-nschandr
/lab1_test_cases.py
1,565
3.609375
4
import unittest from lab1 import * # A few test cases. Add more!!! class TestLab1(unittest.TestCase): def test_max_list_iter(self): """add description here""" tlist = None with self.assertRaises(ValueError): # used to check for exception max_list_iter(tlist) t2 = []...
fee1e5b41576e58b7eecdca4764d834397257fdc
poohcid/class
/PSIT/25.py
605
4
4
"""Grade II""" def main(): """score statement return your level""" score = float(input()) if score <= 100 and score >= 0: if score >= 95: print("A") elif score >= 90: print("B+") elif score >= 85: print("B") elif score >= 80: p...
75bfdb08450ba7c683fcb945663ddac89a14851f
mehrannoori/numerical-analysis
/root/fixed_point.py
345
3.84375
4
import math # f(x)=3x^2-e^x=0 def f(x): return 3*x*x - math.exp(x) # f(x)=x-g(x) # g(x)=sqrt(e^x/3) for [0,1] def g(x): return math.sqrt(math.exp(x)/3) def res(): x0 = 1 x = 0 while True: x = g(x0) if abs( x0-x <= 0.001 ): return g(x) x0 = x if __name__ == "__m...
ab21eae45278f99eb7177b1266e33f53662246d2
arifkhan1990/Competitive-Programming
/Data Structure/Queue/implementation/python/queue_implement_by_array.py
1,148
4
4
class Queue: def __init__(self, max_size = 0): self.size = max_size self.arr = [] def enqueue(self, data): if not self.isFull(): self.arr.append(data) def dequeue(self): if not self.isEmpty(): self.arr.pop(0) def isEmpty(self): retur...
bb650482a6cddb56e8d13b43859cb23791554aa2
aggy07/Leetcode
/900-1000q/989.py
1,339
3.984375
4
''' For a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [1,2,3,1]. Given the array-form A of a non-negative integer X, return the array-form of the integer X+K. Example 1: Input: A = [1,2,0,0], K = 34 Output: [1,2,3,...
7933f3e570ae0b69f569feadfb850ec1019f28bc
manoanjith/python
/27.py
102
3.5
4
g=input() h=g.lstrip('-').replace('.','',1).isdigit() if(h==True): print("Yes") else: print("No")
35e3a9d4fbe278b393887943461494a10172d3e1
AdamZhouSE/pythonHomework
/Code/CodeRecords/2160/60866/253754.py
398
3.640625
4
def chufa(divended,divisor): i=divended j=0 if(divended*divisor<0): if(divended<0): i=-i if(divisor<0): divisor=-divisor while(i>=divisor): i=i-divisor j=j+1 print(0-j) return while(i>=divisor): i...
203a2b957c8c8b780160ec701a07c2edfdb4d134
erauner12/python-for-professionals
/Chapter 1 Python Language Basics/1_5_Collection_Types.py
6,300
4.25
4
# Lists # The list type is probably the most commonly used collection type in Python. Despite its name, a list is more like an # array in other languages, mostly JavaScript. In Python, a list is merely an ordered collection of valid Python values. A # list can be created by enclosing values, separated by commas, in squ...
2d23450569225af07cbf061787aa06958cbca665
DylanBricar/CRBWork
/6eme/ex11.py
191
3.859375
4
a = 5 nb = int(input('Ecrire un nombre équivaut à 5 ou 26 :')) print(nb) if a == nb: a = a + 5 print('a vaut = ' + str(a)) else: print('Le nombre vaut ' + str(nb))
81cd73481e4fdc4e2fb66bbb230c3d396f3f5d25
jaishankarg24/Python-Pickling-and-Unpickling
/ex1.py
396
3.796875
4
#NON Persistent object/temporary object class Student: def __init__(self,name,age,marks): #constructor self.name=name self.age=age self.marks=marks def display(self): #instance method print(f'name:{self.name}') print(f'age:{self.age}') print(f'marks:{self.marks}') if __name__ =...
f2a0607ef0c581c2275bafd88cdc86c142341455
dongbo910220/leetcode_
/Dynamic Programming/1223. Dice Roll Simulation Medium.py
1,133
3.625
4
''' https://leetcode.com/problems/dice-roll-simulation/ ''' class Solution(object): def dieSimulator(self, n, rollMax): """ :type n: int :type rollMax: List[int] :rtype: int """ kMod = 1000000007 kMaxRolls = 15 dp = [[[0] * (kMaxRolls + 1) for _ in ...
250263a647a0924c9cb3ee09a3485b53c2af75bd
smurphy2230/csc-121-lesson14
/iteratorsAndGenerators.py
1,007
4.40625
4
# write a program to find the largest value of a sequence of random # numbers. A function n_random is defined and used to generate the # sequence, and the built-in function max is used to find the largest one import random def n_random(n): random_list = [] for i in range(n): num = random.ran...
44ace9779c20f6ce312c39871aea591590a17856
jonbos/RomanNumerals
/src/number_util.py
636
3.921875
4
import math # # def split_number_into_powers_of_ten(number): """ Splits an integer into an array of integers represnting each power of ten part 1234 -> [1000, 200, 30, 4] """ number_digits = [int(digit) for digit in str(number)] digits_and_powers_of_ten = zip(number_digits, range(len(number_d...
5d2f373a4282942306c6d7d87079af56a462d36f
wancy86/learn_python
/old/set_test.py
1,640
3.90625
4
# 1.找到重复的元素 some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] duplicates = [] for value in some_list: if some_list.count(value) > 1: if value not in duplicates: duplicates.append(value) print(duplicates) # 输出: ['b', 'n'] # 2.找到重复的元素 some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] dupl...
93d73e2b29350c427fcc849dc5c98ce3a6e6a981
ChinnyEmeka/ScrabbleCode
/FindCombosNew.py
1,526
4.125
4
import itertools as it def get_rack_powerset(s): """Return a list of characters that can be added to the board""" for i in range(len(s)+1): for combo in it.combinations(s,i): yield "".join(combo) def remove_duplicates(lst): lst.sort() i = len(lst) - 1 w...
3fafc5e0ad811b96e2458c5e2f96bb56bb76b836
vahidheydary706/tamrin4
/دوز.py
3,185
3.859375
4
import time def show(): for i in range(3): for j in range(3): print(game[i][j], end=' ') print() def win1(): if game [0] [0] =='x' and game [0] [1] =='x' and game [0] [2] =='x': print('player1 wins') exit() elif game [1] [0] =='x' and gam...
7111730be6aa767e27ada04e3eafc8ae474e568f
oatovar/Artificial-Intelligence
/Problem Set 1/data_structures.py
1,043
3.890625
4
class Queue: def __init__(self): self.queue = list() self.counter = 0 def __len__(self): return len(self.queue) def __str__(self): str = "" for state in self.queue: str += state.name return str def getList(self): return self.queu...
0e112e3737857051466fe0a043877b691f9b243c
Bharti20/python_more_exercise
/strong_password.py
422
4.15625
4
password=input("enter the password") if len(password)>=6 and len(password)<=16: if "$" in password: if "A" in password or "Z" in password: if "2" in password or "8" in password: print("strong password") else: print("weak password") else: ...
c32977b405362a9d234e5116231a32395353623c
charlyhackr/holbertonschool-higher_level_programming
/0x06-python-classes/103-magic_class.py
698
4.28125
4
#!/usr/bin/python3 import dis import math class MagiClass: """Represent a circle""" def __init__(self, radius=0): """INitialize a magiClass. """ self.__radius = 0 if type(radius) is not int and type(radius) is not float: raise TypeError("radius must be a number") ...
6bcce96aeb1e3abc71ca735d5a073378053b9a6d
raymondmar61/pythonoutsidethebook
/learnpythonthehardway.py
37,113
4.53125
5
#Learn Python The Hard Way, 3rd Edition .pdf #http://learnpythonthehardway.org/book/ #Do Not Copy-Paste #You must type each of these exercises in, manually. If you copy and paste, you might as well just not even do them. The point of these exercises is to train your hands, your brain, and your mind in how to read, wri...
49080b073b5479f376edf83be7300067cb3e4e0c
ZiyaoGeng/LeetCode
/functions/test_singly_linked_list.py
324
3.921875
4
from singly_linked_list import ListNode # 创建单链表 def create_list(nums): L = ListNode(0) l = L for i in nums: l.next = ListNode(i) l = l.next return L.next # 输出单链表的值 def print_list_val(l): while l != None: print(l.val, end='') l = l.next if l != None: print('->', end='') print()
c05dca87c77799504ba73618e8c407beb680fd39
ArkFreestyle/PythonDesignPatterns
/facade_pattern.py
1,495
3.546875
4
""" The facade pattern is designed to provide a simple interface to a complex system of components. It's pretty similar to the adapter pattern, but here's the main difference: - the facade is trying to abstract a simpler interface out of a complex one. - the adapter is only trying to map one existing interface to anot...
699fe37ea0cd099d235be620eb1f93555e03d51b
mupastir/ImprvSkills
/problem_6.py
597
3.78125
4
''' The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640. Fi...
0e0ca731755610aa2e146312bae2563036ca90fe
BhuwanSingh/Ode_to_Code-
/live.py
1,356
3.703125
4
import pyttsx3 import speech_recognition as sr import json import base64 import wavio # Initialize the recognizer r = sr.Recognizer() # Function to convert text to # speech encode_string = open("audio.wav", "rb").read() wav_file = open("temp.wav", "wb") decode_string = base64.b64decode(encode_string) wav_file.wr...
1ab7c767dfc53f4042b997b19702dd1446f6e9e2
realhardik18/minor-projects
/number guesser.py
192
3.734375
4
import random robo_num=random.randint(1,10) user_num=int(input("guess a number between 1 and 10 herer: ")) if robo_num==user_num: print("YESSS") else: print(f'nope it was {robo_num}')
9b31b05f1bcb1022a7618d3fda18310693a0ea23
COBETCKNN17/coding-dojo
/python/multiples-sum-avg/multiples-sum-avg.py
365
3.75
4
#Multiples for i in range(1,1000): if i % 2 == 1: print i for x in range(1,100000): if i % 5 == 0: print i #Sum List a = [1, 2, 5, 10, 255, 3] vsum = 0 for x in a: vsum+=x print "Sum: ", vsum #Average List a = [1, 2, 5, 10, 255, 3] vsum = 0 for x in a: vsum+=x vavg = vsum/len(a)...
270e6ba49a716452f0e675144c41b523df74af0f
Joslu/Curso-Python
/5. Listas.py
469
3.953125
4
#Son parecidas a los arrays en otros lenguajes de rogramación Mylista = [1,"Luis", 23, 10.5, True] colors = ["blue","green","blue","red"] #Forma de hacerlo con constructor # Utilizando tupla para hacer una lista Lista = list((2,3,4,5)) print(Lista) #Crear lista con range)= Fila = list(range(1,100)) print(Fila) col...
0b7947c7d0f95030eaf7d5ea20db67233bd91907
chenxu0602/LeetCode
/1568.minimum-number-of-days-to-disconnect-island.py
4,084
3.84375
4
# # @lc app=leetcode id=1568 lang=python3 # # [1568] Minimum Number of Days to Disconnect Island # # https://leetcode.com/problems/minimum-number-of-days-to-disconnect-island/description/ # # algorithms # Hard (50.75%) # Likes: 158 # Dislikes: 94 # Total Accepted: 5.2K # Total Submissions: 10.2K # Testcase Exampl...
a70b0794607e5e3e5e23284135e8896b78e84ced
emily-yu/hackerrank
/easy/arrays-ds.py
378
3.671875
4
#!/bin/python3 import math import os import random import re import sys # Complete the reverseArray function below. def reverseArray(a): if len(a) == 0 or len(a) == 1: return a for i in range(len(a) // 2): # print(i) # print(len(a) - i) a[i], a[len(a) - i - 1] = a[len(...
fc53661ab2ab452fe8dfadfb8fa83b38edce2212
nandanabhishek/LeetCode
/problems/1669. Merge In Between Linked Lists/sol.py
1,080
4.21875
4
# Approach-1 : What I thought # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: # Define 2 pointers ...
af4fffa425f93f4c2829777f2e83725cf51b162b
MatiasUK/blackjack
/bjgame.py
3,220
3.8125
4
# blackjack game # Process # Player Cards First (2) # Dealer Cards Next (2) # Display Player Cards to User # Sum of the Dealer Cards # Sum of the Player Cards # Compare the sums of the cards between D v P # If P card sum > 21 = BUST # Loop If P card is <=21 = Twist or Stick (Try) # P twists again - Check <=...
8f06c61f9bd5ffc1f7dd8f8130535e532924f062
nefta1937/memoria
/src/int_posicion.py
6,695
3.84375
4
from io import open import math while (1): print("Para mover de forma automática:1\nPara mover de forma manual: 2\nPara mover 2 robots: 3\nPara mover 3 robots: 4\n Para ordenar robots: 5") L1 = input("Ingrese opción>>") if L1 == '1': print("Insertar coordenadas x,y") x1 =input("x >>...
2aa48627e78ecc771c821d4c514dd8109673ab84
Stopless-K/crawl
/multiprocess.py
1,131
3.53125
4
from multiprocessing import Process, Queue class MP(object): def __init__(self, thread_num, func, args): self.thread_num = thread_num self.func = func self.result = [] self.args = args self.t = [Process(target=self.f, args=(i, self.thread_num, len(self.args))) for i in...
b86ad7e0b2772997271a2f02c8a496169f1a6ee5
Aasthaengg/IBMdataset
/Python_codes/p03455/s882125839.py
160
3.71875
4
a,b = map(int,input().split()) def answer(a: int ,b: int) ->int: if a * b % 2 == 0: return "Even" else: return "Odd" print(answer(a,b))
ab976a0a26b5a870d3c878cf8071caec667af9b6
Nwagner22/motif-mark
/Scripts/fa_converter.py
1,023
3.859375
4
#!/usr/bin/env python # coding: utf-8 import argparse def get_args(): parser = argparse.ArgumentParser(description="A program to convert FASTA files into two lines per record") parser.add_argument("-i", "--input", help="use to specify input file name", required=True, type = str) parser.add_argument("-o", ...
163e941f2372622f49716f5fa93f4384ac5d498a
ChaeSangJung/hankerrank_python
/Algorithms/easy/Implementation/desc_ord_Designer PDF Viewer.py
545
3.609375
4
https://www.hackerrank.com/challenges/designer-pdf-viewer/problem h = [1, 3, 1, 3, 1, 4, 1, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7] word = zaba def designerPdfViewer(h, word): n = len(word) cnt = 0 result = 0 for i in range(n): num = ord(word[i])-97 if(cnt <= h[num]):...
884a4361b5347470befc266ce78a8631fe897276
mabrenu/phyton_basico_2_2019
/Clase#2/Practica#2.py
614
3.859375
4
""" Crear un código que calcule las soluciones de la ecuación cuadrática de la fórmula aX2 + bx +c=0 """ import math #math.sqrt() raiz cuadrada #elevado 2**2 a = float(input('Favor ingresar a')) b = float(input('' 'Favor ingresar b')) c = float(input('Favor ingresar c')) discriminante ...
1688c232317306f717174d6e86de704d06c783b6
MichaelOgunsanmi/dailyCodingChallenge
/July 2019/26th July 2019/pascalsTriangle.py
1,562
3.8125
4
# Source: https://leetcode.com/problems/pascals-triangle/ # Level: Easy # Date: 26th July 2019 # Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. # # # In Pascal's triangle, each number is the sum of the two numbers directly above it. # # Example: # # Input: 5 # Output: # [...
a09a32b58183fefabf768b533821fff9bbec01ad
cuibinghua84/pydata
/python_crash_course/04-操作列表/4.4-使用列表的一部分.py
693
3.640625
4
# -*- coding: utf-8 -*- """ @author: 东风 @file: 4.4-使用列表的一部分.py @time: 2019/10/30 10:59 """ # 4.4.1 切片 players = ['charles', 'martina', 'michael', 'florence', 'eli'] print(players[0:3]) print(players[1:4]) print(players[:4]) print(players[2:]) print(players[-3:]) # 4.4.2 遍历切片 print("Here are the first three players on...
512f01a1261eb1c96485dc9c80c20b5d387c5e0a
kabitakumari20/list_logical
/how_to_find_in_list_int_float_str.py
358
3.78125
4
list=[2, 3.5,4.3,"hello world", 5, 4.3] empty1=[] empty2=[] empty3=[] i = 0 while i<len(list): if list[i]==str(list[i]): empty1.append(list[i]) elif list[i]==int(list[i]): empty2.append(list[i]) elif list[i]==float(list[i]): empty3.append(list[i]) else: print(i) i+=1 pri...
b4e1aafb5cdca7f371a81cbb5493c10149321262
jslee6091/python_basic
/exercise/list_dictionary.py
495
3.53125
4
one = {'id': '1', 'name': 'hong kildong', 'email': 'hong@mail.com', 'hp_num': '010-2343-9870'} two = {'id': '2', 'name': 'lee soonsin', 'email': 'lee@mail.com', 'hp_num': '010-3333-5555'} three = {'id': '3', 'name': 'jang youngsil', 'email': 'jang@mail.com', 'hp_num': '010-7777-1234'} four = {'id': '4', 'name': 'king s...
aa29598e424e9f41efeb88b4e61f9203942047a3
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/131_14.py
2,630
4.3125
4
Python | Get random dictionary pair Sometimes, while working with dictionaries, we can have a situation in which we need to find a random pair from dictionary. This type of problem can come in games such as lotteries etc. Let’s discuss certain ways in which this task can be performed. **Method #1 : Usingr...
f542299f92dbb4025b54b1c6003d9e54d0856ab3
Gairaud/Karatsuba
/src/NumTypes/NaturalNumber.py
9,913
3.96875
4
""" Authors: 1) Kevin Flores G 2) Philippe Gairaud Num Class """ from AbstractNumber import * class Num(AbstractNum): def __init__(self, digits = 0, b = Default_base, is_comple = False): """ Initialize a Num object with digits, base and complement The Num with digits = 3...
f1d9196d8bc8a885df59f888ac2b88de84bf46be
EderBraz/URI---Solutions
/Py/1078.py
170
3.828125
4
# -*- coding: utf-8 -*- """ Created on Wed Mar 14 06:33:19 2018 @author: eder_ """ n = int(input()) for i in range(1, 11): print("{} x {} = {}".format(i,n, (i*n)))
2861be3571f35e7276c459f4de0b82a2924ac7ca
vinkrish/ml-jupyter-notebook
/playground.py
8,097
3.59375
4
a = [-1, 1, 66.25, 333, 333, 1234.5] del a[0] print(a) [1, 66.25, 333, 333, 1234.5] del a[2:4] print(a) [1, 66.25, 1234.5] del a[:] print(a) a = [] del a # dictionary result = 0 basket_items = {'apples': 4, 'oranges': 19, 'kites': 3, 'sandwiches': 8} print(basket_items['apples']) print(list(basket_items.items()) #...
3ba0aa112b821180c995c6bcf12db3ad01541700
prat31/Programming
/Python/justlearningman.py
628
4.125
4
import random print('Hello there! Please enter your name : ', end=' ') name = input() print('Hello '+name+'. I have chosen a number for you between 1 and 10, try to guess it in 5 tries') ans=random.randint(1, 10) for i in range(5): print('Enter your guess : ', end=' ') guess=int(input()) if guess<ans : ...
935879bd5a1cf55648723394aa198ad31c5acc30
103328242/ICTPRG-Python
/pythonprograms/testagain.py
381
4.0625
4
while True: menu = int(input(''' Hello, please select from the following options: 1. add new order 2. list orders 3. exit ''')) if menu == 1: name = input('What is your name?') burger = input('How many burgers?') fries = input('How many fries?') coke = input...
056b131040dd1bd99e279fa573ef0b1aa39bd5a2
elazafran/ejercicios-python
/Ficheros/ejercicio8.py
430
3.78125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' 8.Imprime por pantalla la longitud de la primera línea del fichero datos ''' def crearFichero(): nombreFichero = input("Introduzca nombre de fichero: ") p = open(nombreFichero, "a") p.write("Hola esto es un mensaje") print(p) p.close() def leer...
ca3a8226e005cf4ee6de8d74c391a22467599b53
Bryson14/Numerical_Methods
/src/assn2/driver.py
923
3.6875
4
from Algorithms import get_algorithm, parachutist import sympy as sym def valid_input(): user_input = -1 print("Enter a % error approximation to stop at: ") while 100 > user_input < 0: try: user_input = float(input('-->:\t')) except ValueError: valid_input() return user_input if __name__ == "__main__"...
31b7d1e407eb179ddfdc9685c5733a4c3d3c0dca
chivitc1/pygamedemo
/pygame_demos/ball_moving.py
1,118
3.71875
4
import pygame, sys pygame.init() ball_file = 'images/intro_ball.gif' size = width, height = 640, 480 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size, pygame.RESIZABLE, 32) #create a graphical window ball = pygame.image.load(ball_file) #load our ball image ball_rect = ball.get_rect() pygame.disp...
22cc17837c3af5c9d9132cfbef5a368a34dbee5d
WishingLai/Python-crawler
/code/LinkedList.py
1,744
3.796875
4
import numpy as np # Node declared class Node(object): def __init__(self, d, n=None): self.data = d self.next_node = n def get_next(self): return self.next_node def set_next(self,n): self.next_node =n def get_data(self): return self.data def set_data(self,d): ...
ab232dfbf6421df6c495e8a0a084fcf72097a4e8
jehyn923/personal_projects
/Coding Test/Python/Programmers_전화번호 목록_New풀이.py
1,056
3.65625
4
#효율성 바꾸기 #배운점, 문자열을 sort하면 길이로 sorting 안됨 #문자열 key=len으로 문자열 길이대로 정렬 가능함 #내가 참고한 그 페이지는 문제가 있는 것이다. #합쳐도 괜찮을 듯 def solution(phone_book): answer = True phone_dic = dict() phone_book.sort(key=len) for i in range(len(phone_book)-1): try: phone_dic[len(phone_book[i])][phone_book[i...
5da9e7f7af511be6bce338e98e0ea5072a765715
JKChang2015/Python
/w3resource/rex/Q022.py
200
3.828125
4
# -*- coding: UTF-8 -*- # Q022 # Created by JKChang # Tue, 29/08/2017, 13:31 # Tag: # Description: 22. Write a Python program to find the occurrence and position of the substrings within a string.
b0e6395c8003e074294643c62e5c729fdf7377fb
AlexeyAG44/python_coursera
/week_3/5_ rounding_rus_rul.py
611
3.5625
4
# По российский правилам числа округляются до ближайшего целого числа, # а если дробная часть числа равна 0.5, # то число округляется вверх. Дано неотрицательное число x, # округлите его по этим правилам. # Обратите внимание, что функция round не годится для этой задачи! import math n = float(input()) n1 = n // 1 f_p ...
f634cdff20496f491625560b402654bc6536e30e
HumanKing991/Python_practice_problems
/Find a string.py
357
4.1875
4
def count_substring(string, sub_string): return sum(1 for i in range(len(string)) if string.startswith(sub_string,i)) if __name__ == '__main__': string = input().strip() sub_string = input().strip() count = count_substring(string, sub_string) print(count) ''' Sample In...
e3ec7ebf73589c29d89178e97da960b158c88c23
aparajita2508/learning-python
/script/Exe28.py
574
4.34375
4
"""1. Solve each equality test: 3 != 4 is True True and not ("testing" != "test" or "Python" =="Python") "testing" != "test" is True True and not (True or "Python" == "Python") "Python" == "Python" True and not (True or True) Find each and/or in parentheses (): (True or True) is True True and not (True) Find each not ...
ee142c0fc689ebcac103e03de3c9ca33054df547
BBorisov95/python_fund_homeworks
/07. Water Overflow.py
192
3.796875
4
lines = int(input()) tank = 255 water = 0 for i in range(lines): flow = int(input()) if water + flow > tank: print('Insufficient capacity!') else: water += flow print(water)
1aeadfcf717d5e5476da70fa59ee580c1f30c8d0
slayer-qin/Python-Crash-Course
/3-4~7 list.py
892
4.09375
4
from random import randint MAXGUESTS = 3 guests = [] print("Now, you are going to have a party, Please input the names of you guests") for i in range(MAXGUESTS): name = input("Guest NO.%d>>> " % (i+1)) guests.append(name) num = randint(1, MAXGUESTS) print("Oh! %s can not come,so you need to invite another gu...
6240effee00e0b0d5b54289b5d2258973c322a0a
nisharai26/pythonPractice
/ifOrEx.py
148
4.0625
4
def check_Day(day): if day == "Saturday" or "Sunday": print("Its weekend") else: print("Working Day!") check_Day("Tuesday")
1fbff15401b15315a87965b21a6b03dff098dabe
kperkins411/Python_tutorials
/exceptions.py
380
3.65625
4
def divide(a,b): try: return a/b except ZeroDivisionError as e: raise ValueError('0 divisor') from e try: result = divide(1,0) except ValueError as e: print('ValueError:' + e.args[0]) else: print('%.3f' %result) try: result = divide(1,2) except ValueError as e: print('Value...
55dcfa86bef1f7a7e46c87d1676b8a563623ebb0
KC-Scout/PCC_CH_15_10_TIY
/die_visual.py
486
3.734375
4
from die import Die import matplotlib.pyplot as plt # Create a D6 die = Die() # Make some rolls and store it in a list results = [] for roll in range(10): result = die.roll() results.append(result) print(results) labels = [] frequencies = [] for value in range(1, die.num_sides + 1): frequency = results....
f8a5defea16f5dbd217a19f2891e8c4c84f63bfd
DimaLevchenko/intro_python
/homework_7/task_1.py
548
4.375
4
# Написать функцию которая вернет строку введенную пользователем. # Обернуть функцию в декоратор чтобы функция вместо строки целиком вернула список слов. user_string = input('Enter string - ') def decorate(func): def str_to_list(*args, **kwargs): return func(*args, **kwargs).split() return str_to_lis...
8bd76d6880b05766f4140d9f4fe6984bfbe8dd50
Kutbeddin/Negative-Meaning
/negative_meanıng.py
371
4.46875
4
#Define a function to take a word and return negative meaning. Given a word, return a new word where "not " has been added to the front. However, if the word already begins with "not", return the string unchanged. def not_string(word): x=word.split() if "değil" in x: print(word) else : print("{} de...
d48019ecb9df8e3bdbb1731693d0b028fa0b78b1
rhywbeth/HackerRank-Solutions-Python3
/HackerRank-Problem Solving-Between Two Sets
1,141
3.578125
4
#!/bin/python3 import math import os import random import re import sys # # Complete the 'getTotalX' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER_ARRAY a # 2. INTEGER_ARRAY b # def getTotalX(a, b): # Write your code here m, n =...
be90e448ff04a625dcec359bc4234209be83d77f
JerryCui/examples
/constant.py
562
4.15625
4
'''Illustrate a global constant being used inside functions.''' PI = 3.14159265358979 # global constant -- only place the value of PI is set def circle_area(radius): """circle area caculate""" return PI*radius*radius # use value of global constant PI def circle_circumference(radius): """circumferenc...
83ce871b0e4eca81716f58b1b16b00a5489832f3
ian-everett/python-helper
/WordReveal/main.py
2,762
4.03125
4
''' Reveals a word and the person can stop and guess it ''' import random import time # alphabet ALPHABET = ('abcdefghijklmnopqrstuvwxyz') def get_random_word(words): ''' returns a random word from a list of words or blank '' if no words in list of words ''' length = len(words) if length > 1: ...
57ae09f0670a4630330d0fd6b1d2cc9fb0cd47e7
zatserkl/learn
/python/decorator_recursive.py
1,846
3.8125
4
""" See details about functools.wraps and caching with lru_cache at Answer #3 https://stackoverflow.com/questions/43432956/how-a-decorator-works-when-the-argument-is-recursive-function """ import time from functools import wraps from functools import lru_cache # def rclock(func): # top = True # @wraps(func) ...
bf1ec59770fb854ea72467d9c0f27039b5ebdb64
nrollet/qpaieexport
/qpaieexport/mysqlconv.py
3,817
3.5625
4
import mysql.connector def create_table_sqlgen(table_name, column_list): """ Generate the SQL syntax to create the table table_name: table name string column_list: tables values (each row is a list) """ columns = [] for item in column_list: if item[1] == type(1) or item[1] == "int...
213f16e1e6a944ec1b53a8adc353a6c504fb0a5b
Sivagnanam99/Python-Assessments-
/10.Split.py
160
3.84375
4
str1="Hai , Hello, I am Siva , Welcome To The World" print("\n") print("Original String... \n",str1) print("After Spliting With Comma",str1.split(","))
a4ce761af96eae634c34c6aa4bb39f2a1512fdc1
joysjohney/Luminar_Python
/PythonPrograms/regularExpression/vriablecheck.py
398
3.703125
4
# Rule (20/08/2020) # ==== # 1) First character is an alphabet and it should be with in a-k # 2) Second number should be a digit and it must e divisible by 3 =>(3,6,9) # 3) And the any number of character from re import * rule='[a-k][369][a-zA-Z0-9]*' varname=input("Enter variable name : ") matcher=fullmatch(rule,v...
19782a04a378f9e589c20b3ec1775e3c1cb1bd15
abelthf/algoritmos-y-estructura-de-datos
/Estructura_secuencial/ejercicio8.py
144
3.765625
4
# coding: utf-8 r = input("Ingrese radio de la base: ") h = input("Ingrese altura: ") vc = 3.14159 * r * r * h print "El volúmen es: %s" % vc
7fb764326c073c50daf8fa6a17c536cfd9415766
ak-sergeev/Learn-Algorithms-and-data-structures
/Data-structures/Queue/Queue-Linked-List.py
2,931
3.984375
4
class Node: def __init__(self, value): self.value = value self.next_node = None self.prev_node = None def __str__(self): return self.value class Queue: """ Очередь на базе двунаправленного связного списка. """ def __init__(self, size): self.top = Node(...
ebc9bf4f8fcf8e1f8e1a0c115875d20b7414d15f
Anastasia1807/111
/hw6/Ex5.py
204
4
4
list = [1, 2, 3, 4, 5, 6 , 8, 12, 15, 21, 25] number = int (input('Enter number: ')) for i in range(len(list)): if list[i]%number==0: print(list[i]) else: print("No multiples found")