blob_id
stringlengths
40
40
repo_name
stringlengths
5
119
path
stringlengths
2
424
length_bytes
int64
36
888k
score
float64
3.5
5.22
int_score
int64
4
5
text
stringlengths
27
888k
1aa9a9f8df67db768c73029ea809397d28b938a8
Yhuang93/PyExercise
/TestandExercisePython/test_in_expression.py
78
3.75
4
#Test the "in" expression lst=[1,2,3,4,5] if 8 not in lst: print(lst)
34dbaac743c67e4e1f9bd6b145ed945f9769fbea
badolin/calculator
/bulbulator.py
10,830
3.625
4
from os import system import sys import json class Calculator: def __init__(self): try: with open("memory.txt", "r") as file: self.memory= json.load(file) except FileNotFoundError: with open("memory.txt", "w") as file: self.memory = [] ...
5b9c3856934d9cec9063936199409555cf108b52
zhangbo2008/pytorch_word2vec
/huffman.py
5,703
3.53125
4
# import over_heap as heapq # import heap_file as heapq # import _heapq as heapq import heapq as heapq from anaconda_navigator.utils.py3compat import cmp class Node: def __init__(self, wid, frequency): self.wid = wid self.frequency = frequency self.father = None self.is_left_chil...
92e25c78be26ec13e9fbbd16b8bdc9438d0679bc
zongqiqi/mypython
/1-100/50.py
128
3.671875
4
"""输出一个随机数。""" from random import random numBer = int(random()*100) print ('This is a random number',numBer)
80100942cb61fa5fef4e7b0beb1e9f4b47bf0f0e
yoozoom/stypython
/src/numpage/__init__.py
2,827
3.859375
4
# -*- coding:utf-8 -*- # author yuzuo.yz 2017/7/27 20:43 import numpy as np def main(): list1 = [1, 2, 3] print "start main" print list1 print type(list1) np_list = np.array(list1, dtype=np.int8) print type(np_list) print np_list # 2 print np.zeros([2, 4]) print np.ones([3,...
1babc6f5b7ec6858964f181360d967e76b1951f2
fanliu1991/LeetCodeProblems
/63_Unique_Paths_II.py
2,343
4.3125
4
''' A robot is located at the top-left corner of a m x n grid. The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid. Now consider if some obstacles are added to the grids. How many possible unique paths are there? Note: m and n will be a...
b8c81efbbe0fe825b3aab535bb4fbe55fb7d09b0
Carlisle345748/leetcode
/206.反转链表.py
1,179
3.890625
4
# https://leetcode-cn.com/problems/reverse-linked-list/solution/dong-hua-yan-shi-206-fan-zhuan-lian-biao-by-user74/ # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: """双指针,迭代过程中沿途修改节点指针""" def reverseList(self, head: ...
dbcae823d6898de6214fa663317f94c259523695
wesselvdrest/LAMAS-EpistemicRiddleSolver
/Code/model.py
4,379
3.59375
4
import copy class Model: def __init__(self, states, pointed_state, valuations, relations): self.states = set(states) self.pointed_state = pointed_state self.valuations = dict(valuations) self.relations = dict(relations) self.create_reflexive_relations() def __repr__(se...
6a3269d4f2dd3b5c6f35a154ced7d7793c71cbdf
best90/learn-python3
/common/use_collections.py
1,042
3.921875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import namedtuple #namedtuple是一个函数,它用来创建一个自定义的tuple对象 Point = namedtuple('Point',['x','y']) p = Point(1,2) print('Point:', p.x, p.y) from collections import deque # deque除了实现list的append()和pop()外, # 还支持appendleft()和popleft(),这样就可以非常高效地往头部添加或删除元素 q = dequ...
29a7efa1441bfbce76733535d9090cdfa2fce629
CAAMCODE/crud_facturas
/UNIDAD3/grupode estudio/sabado1.py
3,071
4.0625
4
#----Escribir un programa que gestione las facturas pendientes # de cobro de una empresa. Las facturas se almacenarán en un diccionario # donde la clave de cada factura será el número de factura y # el valor el coste de la factura. El programa debe preguntar # al usuario si quiere añadir una nueva factura, p...
1bcf4cf921fa1cb9569be89f5ddf60f9114c2bda
Ash-one/raspberrypiLED
/Animation/Dot/SpiralDotAnimation.py
836
3.53125
4
import numpy as np from Animation.Dot.DotAnimation import DotAnimation class SpiralDotAnimation(DotAnimation): def createAnimation(self): ''' 生成阿基米德螺旋线 返回一个list ''' coord = [] coordlist = [] for i in range(1, int(self.count+1)): # theta = i * np....
2485e35e9c0b727184080c6cc55408ebf7f9c6c2
SamanehGhafouri/Data-Structures-and-Algorithms-in-python
/Recursion/ch4.7_Exercises.py
3,575
3.921875
4
# R-4.1 Recursive function for finding a max element inside array def recursive_max(i, j, array): if j >= len(array): return array[i] else: if array[j] > array[i]: i = j return recursive_max(i, j+1, array) some_array = [3, 2, 5, 1, 4] max_val = recursive_max(0, 0, some_arra...
fcaf9e7db1d01e53d132865334a2076a6f31dba5
c-romano/code_practice
/edabit_challenges/num_to_dashes.py
124
3.53125
4
# takes a number and returns a line with that many dashes # my/optimal solution: def num_to_dashes(num): return "-" * num
d79ab7ea0a316aed586e0cf16872927ea90c5ce5
ZhouPao/Daily-programming
/by_leetcode/two_add.py
622
3.65625
4
#encoding:utf-8 __author__ = 'zhoupao' __date__ = '2018/8/24 22:48' class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ dic = dict() # 循环遍历出来 for index, value in enumerate(nums): ...
c8ef428197252a2c98881749c78c9e7da85b835e
Crayonjk/Python
/weekday.py
759
3.515625
4
#输入一个年份,判断这天是星期几 def sundayk(year,mouth,day): a = 0 for i in range(1990,year): if year % 4 == 0 and year %100 != 0 or year % 400 == 0: a += 366 else : a += 365 return a def sundayj(year,mouth,day): b = 0 h = 0 if year % 4 == 0 and year % 100 != 0 or year %400 == 0: n = 29 else : n = 28 a...
ad396fdff1808129e7c705274e531ba16fcba598
EggsLeggs/Paper-One-Questions
/2. Checkdigit/beep boop.py
866
3.78125
4
class ISBNcheck(): def main(self): ISBN = [] total = 0 for i in range(13): ISBN.append(self.numberInput()) if i != 12: if i % 2 == 0: ISBN[i]*=1 if i % 2 == 1: ISBN[i]*=3 total += ...
76492afef239a32a894fcd194354242cc1bb9e97
98nikhildaphale/Prime-numbers
/Prime number.py
319
4.125
4
# -*- coding: utf-8 -*- """ Created on Sat Jul 24 09:48:20 2021 """ a=int(input("Enter a number: ")) if a>1: for i in range(2,a): if a%i==0: print(a,"is not a prime number") break else: print(a,"is a prime number")
182a43d310c950c24a305051b324cfa9c6109c00
resb53/advent
/2021/src/day-09.py
2,059
3.53125
4
#!/usr/bin/env python3 import argparse import sys # Check correct usage parser = argparse.ArgumentParser(description="Parse some data.") parser.add_argument('input', metavar='input', type=str, help='Input data file.') args = parser.parse_args() grid = {} lows = [] seen = [] basin = {} # Parse t...
d6c8de90e32b49d93a5e7ee3efbf64c38f23924e
yurigsilva/modulo_introducao_python_e_programacao_python_full
/18_exercícios_numeros_pares.py
190
3.984375
4
#Receba um número e mostre todos os números pares de 0 até o número digitado. n1 = int(input('Digite um número: ')) i = 1 while i <= n1: if i % 2 == 0: print(i) i += 1
537f987bb4485dcc5e3b19a72be56de29e273a1e
RiKjess/SololearnPY
/7. Functional Programming/Commonality.py
364
4.40625
4
""" Sets Sets are created using curly braces and they hold unique values. Given two sets, find and output all the elements that are common to both sets. For example, for the following sets: {'a', 'b', 'c'} {'c', 'd', 'e'} The output should be {'c'}, as it is present in both sets. """ set1 = {2, 4, 5, 6} set2 = {...
40580eb34cd76f31f174f7b0acddb11ffabef150
ProtulSikder/Tic-Tac-Toe
/tic tac toe last.py
9,192
3.59375
4
import pygame,random,sys class main_game: def __init__(self,user_input): self.user_input = user_input pygame.init() self.black = (0, 0, 0) self.white = (255, 255, 255) self.red = (255, 0, 0) self.green = (0, 255, 0) self.blue = (0, 0, 255) self.yell...
9a2067a80b4ad1d0434eff579b2d468fae33fc30
HacksDev/PythonHW
/T1/Task1.4.py
398
3.59375
4
inputResult = input("Введите символы (поддерживает отрицательные числа): \n") numbers = []; temp = "" for ch in (inputResult+" "): sch = str(ch) if (sch in "0123456789"): temp += ch elif (temp != "" and temp != "-"): numbers.append(int(temp)) temp = "" else: temp = "" if (sch in "-"...
0a81b83ea3e2e061842f6b599b84bb062aae3261
DhineshDevaraj/CSV-to-EXCEL-
/cmd csv to excel & json code.py
548
3.796875
4
import pandas as pd import csv import json # without file extension def write_json(fname): jsonfile = open( '%s.json' % fname, 'a') reader = csv.DictReader( open("%s.csv" % fname)) for row in reader: jsonfile.write(json.dumps(row)+'\n') # with file extension def csv2xl(csvFilen...
bca2eabdba18c60c50f5566233e9fb43e0e77199
patcoet/Advent-of-Code
/2017/07/2.py
2,354
3.515625
4
inputt = 'input.txt' tree = {} with open(inputt) as file: for line in file: line = line.strip('\n') words = line.split(' ') name = words[0] weight = words[1] weight = int(weight[1 : len(weight)-1]) branches = [] for i in range(3, len(words)): branches.append(words[i].strip(',')) ...
873a2a639bba8bd42bf2dee52e25bf651ee489d6
sanchezolivos-unprg/trabajo.
/boleta#17.py
466
4.0625
4
# CALCULO PARA HALLAR LA DENSIDAD # INPUT masa=float(input("ingrese la masa en kg:")) volumen=float(input("ingrese el volumen en m3:")) # PROCESSING densidad= masa/volumen # OUTPUT print("######################################") print(" calculo para hallar la densidad ") print("#######################...
74d015ecfd65afb661073ac57a3988e960559e37
Deli-Slicer/CatBurglar
/CatBurglar/entity/physics.py
3,109
3.65625
4
""" Simple runner physics modelled after the implementations included in physics_engines.py inside of arcade. """ from typing import List from arcade import ( Sprite, SpriteList, check_for_collision_with_list ) from CatBurglar.entity.Player import MoveState, Player from CatBurglar.input.KeyHandler import ...
8a8218ed433fa8535de63d61bf54644b2a02f007
laboyd001/python-crash-course-ch6
/person.py
415
4.4375
4
#use a dictionary to store informationa bout a person you know. Store first name, last name, age, and city. Print each piece of information. person = { 'first_name': 'jenn', 'last_name': 'kuhlman', 'city': 'nashville', } print("My girlfriend's name is " + person['first_name'].title() + ...
818bbb5cfcf1bcd1fccd105cabcc3693c26198a7
wangjiezhe/EffectivePython
/chapter01/item03/convert3.py
561
3.671875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- def to_str(bytes_or_str): if isinstance(bytes_or_str, bytes): value = bytes_or_str.decode('utf-8') else: value = bytes_or_str return value # Instance of str def to_bytes(bytes_or_str): if isinstance(bytes_or_str, str): value = by...
232ba1d37b68f64d0460ebaf6263298032a849f0
dinorrusso/jira_python_public
/jira api incident comments.py
1,397
3.671875
4
""" This is a test of using the Python Requests Module to make a REST API call to Jira. This gets the comments for a given issue No error checking It then gets the count of comments and iterates through the response getting values of interest example: Comment ID: 10002 Comment Text: Do this then that and it will ...
c538f497ca63be579eb90ff86df1a66b6093bcdd
Mr-BYK/Python1
/errorHandling/errorHandling.py
1,527
4
4
# Error Handling - Hata Yönetimi try: x=int(input("x: ")) y=int(input("y: ")) print(x/y) except ZeroDivisionError: print("y için 0 girilmez") except ValueError: print("x ve y için bir sayısal değer girmelisiniz") #2.YOL try: x=int(input("x: ")) y=int(input("y: ")) print(x/y)...
f348f86cc9b0f8fd71c780542a5d1c912443ff34
zuigehulu/AID1811
/pbase/day02/code/text3.py
795
4.15625
4
# BMI指数(Body Mass Index) 又称身体质量指数 # BMI计算公式: BMI = 体重(公斤) / 身高的平方(米) # 如: 一个69公斤的人,身高是173厘米 则BMI如下: # BMI = 69 / 1.73 ** 2 得23.05 # 标准表: # BMI < 18.5 体重过轻 # 18.5 <= BMI < 24 正常范围 # BMI >= 24 体重过重 # 输入身高和体重,打印出BMI值,并打印体重状况 a = float(input("请输入您的身高:")) b = float...
610a3bef9033b19323d9acff4c0ea312ff231f2b
bmusuko/greedy
/greedy.py
3,631
3.90625
4
def count(x,y,i): if(i == 3): return(x+y) elif (i == 2): return(x-y) elif (i == 1): return(x*y) else: return(x/y) def convert(i): if(i == 0): return("/") elif(i == 1): return("*") elif(i == 2): return("-") else: return("+") def tulis(arrO,arrt,nilai): if(arrO[1] < 2 and arrO[0] >1): # operas...
4ef08d9d2c255b45547c8cb13b3a346ab72d1d34
frankzhuzi/ithm_py_hmwrk
/02_branch/hm_01_agejudge.py
139
3.90625
4
age_str = input("How old are you?") age = int(age_str) if age >= 18: print("Welcome and have a good day!") else: print("Fuck off!")
f486a652d28ae5a5aef725f8d6a5de9d6c1e48a9
extremums/the-simplest-programs
/Murakkab dasturlar/1 dan n gacha bo'lgan sonlar kvadratlarini yig'indisini topuvchi dastur.py
424
3.625
4
#1 dan n gacha bo'lgan sonlar kvadratlarini yig'indisini topuvchi dastur n=input("Nechchigacha kvadratlarini yig'indisini hisoblab bersin(o'sha sonni o'zi kirmaydi) ") natija = 0 if n.isdigit(): n = int(n) for i in range(n): kvadrati = i**2 natija += kvadrati print('1 dan {} gacha bo\'lgan s...
94ea3033d97c43dd43a770eb9bd38234a02d1720
rafaelperazzo/programacao-web
/moodledata/vpl_data/82/usersdata/239/43487/submittedfiles/decimal2bin.py
166
3.734375
4
# -*- coding: utf-8 n=int(input("Digite o numero na baze binaria:")) zoma=0 i=0 while(n/10)>0: A=n%10 zoma=zoma+(A*(2**i)) n=n//10 i=i+1 print(zoma)
42d8c93faba1a8d7ccf993e490c53f6f637074fd
chintu0019/DCU-CA146-2021
/CA146-test/markers/parse-float.py/parse-float.py
121
3.578125
4
#!/usr/bin/env python3 s = input() i = 0 while i < len(s) and s[i] != ".": i = i + 1 print(s[:i]) print(s[i + 1:])
602399776056a579ebcb50680fc93884dd1a0a92
kawinm/HackerRank
/HackerRank/Python/Introduction/Integer_Come_In_All_Sizes.py
770
4.1875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Problem Statement Integers in Python can be as big as the bytes in your machine's memory. There is no limit of 231−1 (c++ int) or 263−1 (C++ long long int). Let's try this out. As we know, the result of ab grows really fast with increasing b. We will do some caculati...
42ee10e9ee5c8e0d3db72f0c5eb5e1cd967f21f0
Janardhanpoola/Python
/py_classes/e1.py
3,496
3.765625
4
class Robot: def __init__(self,name,color,weight): self.name=name self.color=color self.weight=weight def Introduceself(self): return f'Hello world,Im {self.name}' r1=Robot("Tom","red",40) r2=Robot("jerry","blue",30) print(r1.Introduceself()) ############ class Person: ...
e074df32bf226f7ab6ccd26029d4a7f04b6ad9d9
TonFw/reforco
/decisao/8-produtos-comprar-mais-barato.py
559
4.125
4
produto1 = input('Informe o nome do produto 1: ') valor1 = float(input('informe o valor do produto: R$ ')) produto2 = input('Informe o nome do produto 2: ') valor2 = float(input('informe o valor do produto: R$ ')) produto3 = input('Informe o nome do produto 3: ') valor3 = float(input('informe o valor do produto: R$ '...
10793266db575381e286d2a02f8ddfaf5c171091
mateusrmoreira/Curso-EM-Video
/desafios/desafio51.py
457
4.09375
4
""" Desenvolva um programa que leia um número inteiro e mostre o primeiro termo e a razão de uma PA. no final mostre os 10 primeiros termos """ primeiro = int(input('Escreva o primeiro termo ')) razao = int(input('A razão da PA ')) decimo = primeiro + (10-1) * razao print(f'O primeiro número é {primeiro} E a razão é...
b025eb9774576a972340e9ac652ac9a789170488
yunjung-lee/class_python_data
/csv_SQLite_save_direct.py
1,570
3.5625
4
## 여러개의 대용량 CSV 파일 --> SQLite from tkinter import * from tkinter.simpledialog import * from tkinter.filedialog import * import csv import json import os import os.path import xlrd import xlwt import sqlite3 import pymysql import glob con = sqlite3.connect('c:/temp/userDB') cur = con.cursor() # 폴더 선...
59dceacf4f5b52fe9e421d0a379d5174915756bc
AshayAswale/UrbanPlanning
/main.py
1,479
3.609375
4
import sys import numpy as np import random from hill_climb import HillClimb from genetic_algo import GeneticAlgo def getUrbanMap(argv): """ Extracts the Urban Map from the input file """ urban_file = open(argv[0]) text_from_file = urban_file.readlines() urban_map = [] for i in range(3, l...
fa26940fb21a6da0bf8c5056c8c0b389125e9478
Florian-Moreau/Development-Python
/SIO 1/Tableau saisi valeur.py
489
3.703125
4
n=int(input("Entrer le nombre d'éléments du tableau : ")) T=[0]*n #Permet d'ajouter un nombre saisi dans le tableau T negative=0 positive=0 nulle=0 for i in range(n): print("Entrer l'élément N° ",i+1,end=" : ") T[i]=float(input()) if T[i]<0: negative=negative+1 elif T[i]>0: po...
c9f7ec7accc4750d87c7b77e9f52b5fe0ebc58c7
co-jo/kattis
/lastfactorialdigit/sol.py
127
3.609375
4
from math import factorial cases = int(input()) for i in range(cases): n = int(input()) print(str(factorial(n))[-1])
f1c79094bd439f573fa8d4ad7481e059a2dff9c5
CodyBuilder-dev/Algorithm-Coding-Test
/problems/programmers/lv2/pgs-12949.py
930
3.6875
4
""" 제목 : 행렬의 곱셈 구현 : 그냥 list로 구현할 수 있다 (1) 그냥 반복문 - 4중 for문으로 구현해야 할 수도 있음 ㄷㄷ (2) Transpose를 이용한 연산 간략화 - sum_list만 구현해 놓으면 알아서 해결됨 """ def inner_product(a,b): return sum([i*j for i,j in zip(a,b)]) def solution(arr1, arr2): arr2 = [list(x) for x in zip(*arr2)] result = [[0]*len(arr2) for x ...
df09f98565ea6f036ac24e14b1f196ac727efc63
waverim/leetcode
/python/climbing-stairs.py
1,013
3.953125
4
""" 动态规划: 爬一层台阶只需1步,爬2层台阶有2种方法:2个1步、1个两步 爬3层台阶:在爬完第1层台阶后、爬两步,或者,爬完第二层台阶后、爬一步 ... 爬n层台阶:在爬完第n-2层台阶后、爬两步,或者,爬完第n-1层台阶后、爬一步 故case(n) = case(n-2) + case(n-1) 由于递归太占资源,用迭代, a为爬n-2层台阶数,b为爬n-1层台阶数,result为爬n阶台阶数 每次迭代,替换相应的台阶数 为了减少代码量,初始化时从负两层开始 """ class Solution: # @param n, an integer # @return an integer def ...
15270ba1fd4124bd4bbb1ec1b56682732f4407ec
RisingThumb/AdventOfCode2019
/DAY_10/SOLUTION_1.py
2,071
3.5625
4
import math import itertools from collections import defaultdict import pprint # part 1 stuff with open("input1.txt","r") as f: data = f.readlines() points = [] for y in range(len(data)): for x in range(len(data[0])-1): if data[y][x] == '#': points.append([x,y]) maxSighted = 0 keyPoint = [0,...
86e3c8224bef0b75ba21c0206132f588a23e248f
Sudharsan25/PythonProjects
/BasicProjects/CapShield.py
1,062
3.890625
4
# from turtle import * # color('green') # bgcolor('black') # speed(11) # hideturtle() # b = 0 # while b < 200: # right(b) # forward(b * 3) # b = b+1 # from turtle import * # bgcolor("black") # speed(0) # pensize(4) # pencolor("blue") # def draw_circle(radius): # for i in range(10): # circle(r...
a05bc92ec3c2712d1df9826cd72f9a3406184eda
welgt/Exercicios_python_pi2_Dp
/Aula01/Ex03_Soma2n.py
105
3.6875
4
n1 = int(input('Informe 2 numeros para serem somados:\n')) n2 = int(input()) print('A soma é: ', n1+n2)
6579c12f3c32f9071f357646d85709ca4abe989b
zeyucheng/learn-python
/tempreture.py
104
3.625
4
temp_c = input("plz input the temp: ") temp_c = float(temp_c) temp_f = temp_c * 9 / 5 + 32 print(temp_f)
de589bad9ef61445dcb73c34cdcb22cf10ac321a
pondjames007/CodingPractice
/AlgoDS_SP/BinarySearch.py
314
3.65625
4
def binary_search(l, r): while l < r: m = (l+r)/2 if f(m): return m # check if m is the answer or not (optional) if g(m): # check next round should go left or right r = m # new range [l,m) else: l = m+1 # new range [m+1, r) return l # or not found
3ec5719b08f8e8fa5122843f39165a3a2c646c0a
brij1823/DSA-Codes
/coding interview/array and strings/fourth_palindrome.py
1,026
3.875
4
'''#Approach 1 string1 = input() length = len(string1) hash_table = {} #dict.setdefault(hash_table, default=0) for i in string1: if(i in hash_table.keys()): hash_table[i]=hash_table[i]+1 else: hash_table[i]=1 flag = 0 for i in string1: if(hash_table[i]%2!=0): flag=flag+1 if(length%...
7338cfe2f705589d93699dfda3351572e3282308
gittygupta/Machine-Learning-Basics
/Part 4 - Clustering/1. K-Means Clustering/kmeans.py
2,726
4.0625
4
# K-Means Clustering # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset with pandas dataset = pd.read_csv('Mall_Customers.csv') # Splitting into dependent and independent variables x = dataset.iloc[:, [3, 4]].values # Using the elbow...
9c79895a959e69ee32ea0476ab79fae307a2dcaf
ravinduu/python
/data_structures/search/binary_search.py
480
3.984375
4
nums = [32,43,123,12,43,5743,9438,4343,4321,1,32,54,437,672,65,34,163,781,32,4983,56,68,80,9,7,66,6] def binary_search(nums,val): nums.sort() lower = 0 upper = len(nums)-1 while lower <= upper : mid = (lower+upper)//2 if nums[mid] == val: return True else: if nums[mid] > val: upper = mid-1 else...
6c59089c1beefc06e4104fc260dca57069de504d
luizaacampos/exerciciosCursoEmVideoPython
/ex082.py
400
3.65625
4
lista = [] pares = [] impares = [] while True: n = int(input('Digite um número: ')) lista.append(n) if n % 2 == 0: pares.append(n) else: impares.append(n) q = str(input('Quer continuar? [S/N] ')).upper().strip()[0] if q == 'N': break print(f'A lista completa é {lista}') p...
0800735f2194388ad9c9f5e5ee46b727984bfa1c
TsaiRenkun/coffee_machine_python
/Problems/Practice test/codetest.py
1,481
3.546875
4
import math print("working") def dynamic(pi, Qtyi): # pi also represents the parent node. # pi will be an object with itemID, stocks, Qty stocks = math.floor(int(pi.stock)/int(Qtyi)) return stocks def fixed(pi,Qtyi,Si): stock_fixed=(int(Qtyi) * int(Si)) return stock_fixed item_array = [] class nodes: def __...
9db637dfe78e643f3a4339465ed7d2122b590e41
Navya140311/Picnic-Project
/picnic.py
758
3.65625
4
from tkinter import * import random root= Tk() root.title('Picnic Bag') root.geometry('400x400') root.configure(background='yellow') item_label= Label(root) random_no_label= Label(root) picnic_list=["Bottle","Tiffin","ID Card","Chocolates","Chips","Tickets","Hanky"] item_label["text"]= "Listed Items ...
afa26135a76c93580d9ac6a2eb39ecac723130aa
jashidsany/Learning-Python
/Codecademy Lesson 5 Loops/LA5.20_Reversed_List.py
440
4.3125
4
#Write your function here def reversed_list(lst1, lst2): for index in range(len(lst1)): # for each element in the lenght of lst1 if lst1[index] != lst2[len(lst2) - 1 - index]: # if the index in lst1 does not # lst2 (length of lst2 - 1 - index) return False return True #Uncomment the lines be...
7bb0040c38361ab5d9ffc69e11478a49db594b87
CodeTemplar99/learnPython
/Functions/keyword_arguments.py
1,023
4.25
4
# an argument is a value passed when calling a function def increment(number, by): return number+by value = increment(2, 1) print(value) # the above code will return 3 # to simplify this it can be written as def increment2(number, by): return number + by # value2 = increment2(2, 2) print(increment2(2, ...
44addf319765edf14293bcad0b254be3e681655a
Edwinroman30/Python_practices
/To_Practices/Basics_Practices/Exercise03.py
384
3.90625
4
#Studen: Edwin Alberto Roman Seberino. #Enrollment: 2020-10233 #3. Almacené dos números y evalué si el primero es mayor que el segundo. El resultado debe mostrarlo por consola. num1 = 50 num2 = 15 if (num1 > num2): print('{0} es mayor que {1}'.format(num1,num2)) elif(num1 < num2): print('{1} es mayor que {0...
d2fc14c04777a21d20137ef910840adfd4a16fed
Yogesh6790/PythonBasic
/com/test/ConditionalStatements.py
319
4.25
4
fruit1 = 'apple' fruit2 = 'orange' print(fruit1 == fruit2) print(fruit1 != fruit2) i = int(input('Enter number : ')) if i < 0: print('less than 0') elif (i == 0 or i >= 0) and i < 5: print('between 0 nd 5') else: print('greater than 5') #iterate through a string strTest = "Hello, where are you?"
bcfe41b22afea4796d17c89929460e4c98d199d2
Kaminagiyou123/python_cookbook
/4_Iterators_generators/4.5_Iterating_in_Reverse.py
312
3.671875
4
a=[1,2,3,4] for x in reversed(a): print(x) class Countdown: def __init__(self,start): self.start=start def __iter__(self): n=self.start while n>0: yield n n-=1 def __reversed__(self): n=1 while n<=self.start: yield n n+=1 print('-'*20) for n in reversed(Countdown(3)): print(n)
e558d131f265a2847f801a5bbb4f819696b69bda
PhenixZhang/Python-Data-Structure-and-Algorithm
/Recursion&divide-conquer/雪花曲线.py
429
3.515625
4
import turtle def koch(t,order,size): if order ==0: # 边界条件 t.forward(size) else: koch(t,order-1,size/3) # 递归调用 t.left(60) # 笔转60度 koch(t,order-1,size/3) # 递归调用 t.right(120) # 笔转120度 koch(t,order-1,size/3) # 递归调用 t.left(60) # 笔转60度 koch(t,order-1,size/3) # 递归调用 if __name__ == '...
a96710a869c4e787aea745e45a34fe54071777d1
myGitRao/Python
/FaultyCalculator.py
1,245
3.90625
4
# # calculate the values correctly except for the below calculations: # # 45*3= 555 # # 56+9 =77 # # 56/6 =4 while True: decision = input("You wanna do operations on numbers:Press : Yes or No ") if decision.lower() == "yes": print("Inside the loop") inp = int(input("""Enter the operation you wan...
ea628b1b63645a59de4c0d7ae5574c5c968872b3
Gyuchan3/STEP2021
/class2/matrix-graph.py
1,275
3.515625
4
import numpy, sys, time import matplotlib.pyplot as plt x = [] #[0,1,...,N] y = [] #execution time for each n if (len(sys.argv) != 2): print("usage: python %s N" % sys.argv[0]) quit() N = int(sys.argv[1]) for n in range(N + 1): a = numpy.zeros((n, n)) # Matrix A b = numpy.zeros((n, n)) # Matrix B ...
aa3b80ec374b7f87fa6a06b437ec5cb4054b9566
sandrosa1/instrucoes_python
/verificacao_ordenada/4FizzBuzzp3.py
140
4
4
a = int(input("Digite um numero inteiro ")) resto = a % 3 resto2 = a % 5 if resto == 0 and resto2 == 0: print("FizzBuzz") else: print(a)
aa121c7a0da9b4cbbfb6a55750898dab3931d430
27Saidou/cours_python
/test_condition.py
71
3.546875
4
i= 0 while i<11: if i%2==0: print("est pair\n",i) i+=1
6330a513293c247bc350932b4f7fded8643c1c2c
isabelaaug/Python
/escrever_arquivos.py
569
3.90625
4
""" Escrevendo em arquivos with open('novo.txt', 'w') as arquivo: # w - white e cria o arquivo ou abre o xistente com esse nome arquivo.write('Joga com delicadeza.\n' * 12) # subscreve os dados do arquivo arquivo.write('Ela bate o bumbum no bumbo.') with open('texto.txt') as arquivo: # w - white arquiv...
7c55674c604728482ce0cec4631a660c61b051ea
operation-lakshya/BackToPython
/MyOldCode-2008/JavaBat(now codingbat)/Recursion1/array11.py
334
3.75
4
from array import array a=array('i') n=input("\nEnter the length of the array:\t") k=0 while(k<n): a.append(input("\nEnter the element")) k=k+1 def array11(a,n): if(n==len(a)): return 0 elif(a[n]==11): return 1+array11(a,n+1) else: return array11(a,n+1) s=input("\nEnter an index to count for '11':\t") print ...
c0dbd0969ca5948f8013ec5750e0bb6219d4ec95
ricardoruiz19/material-intro-prog
/Ejercicios/a. Recursión/SolucionEjemplosVideos.py
5,539
4.03125
4
def ejemploFactorial(num): if num == 0: return 1 else: return num * ejemploFactorial(num-1) def ejemploFactorialMensajes(num): if num == 0: print("Entre al caso base") print ("Voy a retornar", 1) return 1 else: print ("Entre al caso general") prin...
f4dce8797e4856398063c9812ce223ee098187b2
cbhagavathy/pythonscripts
/loop.py
556
3.984375
4
count = 1 while count <= 5: print (count) count += 1 while True: name = input("Enter the name [type q to quit]") if name == "q": break print(name.capitalize()) while True: value = input ("Integer, please [q to quit]: ") if value == "q": break number = int(value) if number % 2 == 0: continue print (...
0682cb417c6b55897db3acc2158f3e0f5246ebf8
LulutasoAI/Disposal
/Randompersona.py
2,723
3.78125
4
import random class Persona_Generator(): "I thought This was a good idea but this is useless as something I can not even remember for once in my life" def __init__(self): self.name = self.pickone_from_list(["Aren", "Naron","Sharon"]) self.age = random.randint(15, 100) self.sex = self.pic...
c63c8773a661399e7046d81fb3333f820d8eb460
Eminem0331/Stock_test
/Model/33.py
197
3.90625
4
age=int(input("请输入年龄:")) # print('if语句开始判断') # if age>=18: # print("成年") # print("if语句结束判断") if age>=18: print("成年") else: print("未成年")
0e8fdfbdef48eeef87d850e4fd4ba0471e79a7fb
wilhelmsen/skillshouse-python
/intermediate_python/dag_1/003_objects.py
3,592
3.671875
4
#!/usr/bin/env python # coding: utf-8 # Functions # Hello world. def print_hello_world(): """ En docstring prints hello world """ print "Hello verden" print_hello_world() # docstrings er altid en god ide. ..virker med help(print_hello_world) print print_hello_world.__doc__ # Default værdier. ...
75969207c2641b186556a5923d58b7fd66ad8633
hcuny/Leetcode
/BIAN_YUAN_Code/38.py
1,061
3.5
4
""" Key point: designed 2 pointers i & j indicating start and end position of each component example: 1122211, 3 component: "11","222","11" """ class Solution(object): def countsay(self, n): #Designed to get the next element in the sequence given the previous one s=list(str(n)) i,j,di...
28be52f9b8519c9f42bb4cf0747526135fe885ca
cosasha97/kernel-methods-challenge
/scripts/utils.py
9,382
3.71875
4
""" Useful functions """ import numpy as np import pandas as pd import os from sklearn.model_selection import GridSearchCV import csv import random # data creation - TOY EXAMPLES - useful for testing # code for blobs and two_moons come from the class of Graphs in Machine Learning def blobs(num_samples,...
27639789377d3ca969adb56a7d5d14956ae582a4
Pasquale-Silv/Improving_Python
/Python Programming language/SoloLearnPractice/ListsInPython/RangeInList.py
709
4.5625
5
""" The range function creates a sequential list of numbers. The code below generates a list containing all of the integers, up to 10. If range is called with one argument, it produces an object with values from 0 to that argument. If it is called with two arguments, it produces values from the first to the second. r...
991cbb6cb4a1fef664203e3b62b2d5f41c04a61d
MOysolova/Python
/week_4/4.Count-Vowels-Consonants/count.py
514
4.1875
4
word = input("Write a word: ") def count_vowels_consonants(word): vowels_list = "aeiouyAEIOUY" consonants_list = "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ" number_vowels = 0 number_consonants = 0 result = {} for ch in word: if ch in vowels_list: number_vowels += 1 if ...
99b4a774e64558bcd2553fa47ce3f1e025e4efc8
WJChoong/Exercise-Python
/Exercise/marks.py
1,791
3.984375
4
average=[] descending_order=[] average2=[] print("-"*10+" Bowling Scores Statistics for each player "+"-"*10) for p in range (3): score=[] highest_score= 0 print("Player "+str(p+1)) for game in range(5) : mark= input("Enter score for the game "+ str(game+1)+": ") score.append...
bbd56228a1be28b7143807ec8ced98b9a73621e8
thangduong3010/learn-python-the-hard-way
/ex36.py
7,608
3.65625
4
from sys import exit def formation_vote(): print "Choose your formation:" formation_list = ['4-4-2', '4-3-3', '3-4-3', '3-5-2', '5-3-2'] for form in formation_list: print form choice = raw_input("> ") if choice == '4-4-2': formation_442() elif choice == '4-3-3': ...
ccd95584aa8f1cb885e412694ac687147a959c4f
lamperi/aoc
/2017/17/solve.py
711
3.515625
4
example = 3 data = 314 def func1(data): buf = [0] current_pos = 0 for i in range(2017): current_pos = (current_pos + data) % len(buf) buf.insert(current_pos+1, i+1) current_pos += 1 return buf[(current_pos + 1) % len(buf)] print(func1(example)) print(func1(data)) def func2(d...
38f5ef346a0881db05417a0280d1c379cecf80f9
Bransonn/card-games
/war.py
3,152
4.0625
4
# Imported so the lists can be shuffled import random # Creating Decks with values 1-10. The values are used as cards edeck = [1,2,3,4,5,6,7,8,9,10] deck = [1,2,3,4,5,6,7,8,9,10] # The empty 'hands' recieve cards through a pop() from their respective decks hand = [] ehand = [] # Each turn, one of these numbers goes up...
882b0825d276a55b89c668ad46d859b06a45fecd
antohneo/pythonProgramming3rdEdition
/PPCh8PE13.py
2,050
3.9375
4
# aaa # python3 & zelle graphics.py # Python Programming: An Introduction to Computer Science # Chapter 8 # Programming Excercise 13 from graphics import * def main(): # open grapics window win = GraphWin("Regression Line", 600, 600) win.setCoords(-10, -10, 10, 10) win.setBackground(color_rgb(36, 66...
8d428e803f150fd62ac3203f8fd4252d186a3b6f
ruirodriguessjr/Python
/EstruturaSequencial/ex05AntecessorSucessor.py
156
3.96875
4
n = int(input("Informe um número qualquer: ")) a = n - 1 s = n + 1 print("Analisando o nº {}, seu antecessor é {} e seu sucessor é {}.".format(n, a, s))
6ca6f7ff9697e0d85e77037a27b93ddae85d183f
jrortegar/Codeforces
/problem50A-14.py
147
3.671875
4
def dividir(a,b): return int (a*b/2) def main(): cadena=input() lista=cadena.split(" ") print(dividir(int(lista[0]),int(lista[1]))) main()
c6668aa67b03b199975e5fe0caff2bbdf62baac7
chrisdav1022/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
186
3.953125
4
#!/usr/bin/python3 """Function that append""" def append_write(filename="", text=""): """string to a file""" with open(filename, 'a') as fl: return fl.write(str(text))
cd674c351476950c74516a3723049241309aebcf
CAP1Sup/SieskoPython
/Experimental/LoopCreator.py
493
4
4
# Christian Piper # 9/13/19 # This program will allow the user to input the paramaters for a switch case statement. It will then print the code out to the command line. def main(): caseCount = input("Input the number of case statements you would like: ") inputNames = input("Would you like to generate it with t...
cab3e219537691a8d3387e6c006e1e282a6eac9c
dofany/python300
/211_220_파이썬 함수/220.print_max.py
348
4
4
# 세 개의 숫자를 입력받아 가장 큰수를 출력하는 print_max 함수를 정의하라. 단 if 문을 사용해서 수를 비교하라. def print_max(x,y,z): if x > y: if y > z: print(x) if x < y: if y > z: print(y) if x < y: if y < z: print(z) print_max(3,4,5)
72b07cd52bcdb990cd771447f71992a6b914e106
PET-Comp-UFMA/Monitoria_Alg1_Python
/05 - Funções/q06.py
453
4.03125
4
#Questão 6 #Faça uma função que converta uma temperatura dada em Fahrenheit para Celsius ou Kelvin, #dependendo da conversão sinalizada. def converteTemp(temperatura, escala): escala = escala.lower() if escala == "celsius": resultado = (temperatura - 32)/1.8 elif escala == "kelvin": resulta...
8461dc07096edfbb889d7e7d0285a78d6e1bb63f
Ageor21/RPG_Game
/main.py
10,992
4.03125
4
import random # A list of alignment choices alignment = ["Law", "Neutral", "Chaos"] # A list of classes that the user can choose from classes = ["warrior", "knight", "mage", "thief", "cleric", "pyromancer"] # Weapon selection weapons = ["sword", "spear", "spell staff", "knives", "wand", "mace"] # Health for the use...
20c5afa73d6a795d3659baebb4eaaa5195e2bcb3
Kunal352000/python_adv
/18_userDefinedFunction28.py
277
3.921875
4
def f1(x,*y,**z): print(x,type(x)) print(y,type(y)) print(z,type(z)) f1(2)#this executes f1()#this give error """ output: ------- 2 <class 'int'> () <class 'tuple'> {} <class 'dict'> TypeError: f1() missing 1 required positional argument: 'x' """
208c4947e459e8e6042d8895a2e12b8798b87003
hemamalniP/Task1-Python-basics
/longest string.py
381
3.609375
4
def common( a): size = len(a) if (size == 0): return 0 if (size == 1): return a[0] a.sort() end = min(len(a[0]), len(a[size - 1])) i = 0 while (i < end and a[0][i] == a[size - 1][i]): i += 1 match = a[0][0: i] return matc...
6460f978137f9f66cf74e4cdf7b220933b21dcbf
racamirko/proj_euler2014
/problem313.py
3,674
3.65625
4
import itertools as it __author__ = 'raca' horizontal_step = [0, 1] vertical_step = [1, 0] def generate_primes(n=1000000): primes = [] prime_flags = [0] * (n + 1) for prime in xrange(2, n): if prime_flags[prime] == 0: primes.append(prime) else: continue mu...
ea7594aadcef5561f06cd51c3c1ae4b6d4dc3e0e
hariprabha92/anand_python-
/chapter2/problem17.py
604
4.5
4
''' Write a program reverse.py to print lines of a file in reverse order. $ cat she.txt She sells seashells on the seashore; The shells that she sells are seashells I'm sure. So if she sells seashells on the seashore, I'm sure that the shells are seashore shells. $ python reverse.py she.txt I'm sure that the shells ...
aef0ecac950946c4a380fcb32fdfbaaf68121713
JackyCafe/basicProject
/basic_11.py
226
3.75
4
class Bike: speed = 0 def speedup(self): self.speed += 3 def __str__(self): return str(self.speed) judy = Bike() judy.speedup() print(judy) judy.speedup() print(judy) judy.speed = 100 print(judy)
2e754e9600e7540dcee16964a4c756982be3f1c3
Taoge123/OptimizedLeetcode
/LeetcodeNew/Graph/LC_997_Find_the_Town_Judge.py
2,034
3.84375
4
""" In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge. There is exactly one person that satisfies properties 1 and 2. You ar...
068d2ab59f2c7066dcdc516f532fa25e3f8e81d6
wssyy1995/python_note
/数据结构和算法/二叉树.py
1,796
4.125
4
完全二叉树和满二叉树: (1)满二叉树属于完全二叉树,但是每层都挂满了节点,总节点数为2^h-1 (2)完全二叉树的高度是h的话,第1-(h-1)层都是满节点,即满二叉树,第h层的节点是紧靠左排列的;总节点数范围为2^(h-1) ~ 2^h-1 二叉树的遍历 -广度优先:一层层遍历,每一层从左向右遍历 -深度优先 -先序遍历:根—左—右:从根开始,就先将根pop进队列,每一层都是先访问左边子节点,如果子节点有下一层孙节点,就下探到孙节点的左边子节点(如果当前下探的左边子节点没有下一层,才遍历右边的节点,但是右边的节点往下也是从左边开始遍历) -中序遍历:左-根—右:每一层也都是向子...
849aaf91321dc79ce003b92f6c80e84dcd2c62eb
juliakimchung/classes
/sidekick.py
390
3.515625
4
class Sidekick(object): def __init__(self, name): self.name = name self.gender = "" self.alter_ego_profession = None def __str__ (self): # side_kick_output = "" # for sidekick in self.Sidekick(): # side_kick_output += side_kick_output # return "{} is superhero's {}".format(self.name, side_kick_output...
f1780531ad2ba4c680da6b85c6ebb7af24e80138
tusharjindal/brain-tumor-classification
/app.py
879
3.515625
4
import streamlit as st from PIL import Image from img_classification import teachable_machine_classification st.title("Image Classification project") st.header("Brain Tumor MRI Classification ") st.text("Upload a brain MRI Image for image classification as tumor or no-tumor") uploaded_file = st.file_uploader("C...
d3024a0dc102f826ecde6696556f9151d7e002bb
satyam-seth-learnings/python_learning
/Python Built-in Modules/Python Itertools Module/3.Terminating Iterators/11.tee()/1.Example_Of_tee().py
168
4.15625
4
import itertools li = [2, 4, 6, 7, 8, 10, 20] iti = iter(li) it = itertools.tee(iti, 3) print ("The iterators are : ") for i in range (0, 3): print (list(it[i]))