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
8bec62bd5903c311834ea41129e6a5ef976d97e3
feicun/practice
/python/divisors.py
194
3.859375
4
num = int(raw_input("Please choose a number to divide: ")) list_range = list(range(1, num + 1)) divisors = [] for i in list_range: if num % i == 0: divisors.append(i) print divisors
fc89d6fd34d6d957eb8502654629b1a2821a0ad6
PythonAlan/Mini-Project
/day6 adventure/day1/for_guess.py
402
3.84375
4
__author__ = 'uesr' mynumbers = 16 for i in range(3): guess = int(input('Pls guess my number :')) if guess < mynumbers: print('Pls try to guess again.It may be bigger than...') elif guess > mynumbers : print ('Pls try to guess again.It may be less than...') else: print('Bingo...
b99344e168ce977408c963bd3d254a301505ae0a
Paletimeena/Prac_data
/Meena (copy)/python/reference-code/conditional/con4.py
499
4.40625
4
#!/usr/bin/python operator=raw_input(""" Please enter the operator would you to complet 1.+ for addtion 2.- for subtraction 3.* for multipication 4./ for division 5.% for remendar 6.** for power 7.// for floatting formate """) num1=input("\nPlease enter the 1st number\n") num2=input("Please enter the 2nd number\n") num...
2473c17339ccdf4fc5be6a006092eeeb281fbe06
minh-quang98/nguyenminhquang-fundamental-c4e20
/Session03/Homework/turtle_2.py
312
3.84375
4
from turtle import * shape("turtle") col = ["red", "blue", "brown", "yellow", "grey"] speed(-1) for j in range (5): begin_fill() color(col[j]) for i in range(2): forward(100) left(90) forward(150) left(90) pu() forward(100) pd() end_fill() mainloop()
9bdcf11995300f20a35191b332f3ff99dd095760
itwebMJ/pythonStudy
/5day/3. func3.py
1,118
3.65625
4
def yaksu(num): for i in range(1,num+1): if num % i == 0: print(i, end='\t') yaksu_num = int(input('약수를 구할 수 입력 :')) yaksu(yaksu_num) #print(yaksu(yaksu_num)) print() def yaksu2(num): res=[] for i in range(1, num+1): if num % i == 0: res.append(i) return res def y...
02a4f03ba086a49a5983987f93ae20a146f77d65
deadman619/little_programs_and_learning_stuff
/simpleLootSystemAlgorithm.py
574
3.796875
4
def displayInventory (inventory): print('Inventory: ') item_total = 0 for item, amount in inventory.items(): print (item, amount) item_total += amount print('Total items: '+str(item_total)) def lootItems(inventory, addedItems): for item in addedItems: if item in inventory: ...
6bf622dfbbc5715ec3fb035b1965c63b52b83aa1
bretonics/MSSD
/CS521/Homework/hw_3/hw_3_13_1.py
648
4.15625
4
#!/usr/bin/env python import re f_name = input("Please enter a file name: ") f_in = open(f_name, "r") string = input("Please enter string to be removed: ") content = f_in.read() # Read in all file as one string, replace word string with empty string, and print result print("\n", content.replace(string, ''), sep='') p...
25152ad016f2db58859739a414f3422900970453
ArbiBouchoucha/TensorFlow-Examples
/examples/1_Introduction/build_high_performance_data_pipeline.py
2,897
3.65625
4
''' This python script is implemented following this link: http://adventuresinmachinelearning.com/tensorflow-dataset-tutorial/ Author: Arbi Bouchoucha Project: https://github.com/ArbiBouchoucha/TensorFlow-Examples ''' import tensorflow as tf import numpy as np x = np.arange(0, 10) # Create dataset object from numpy...
4ab598b8223f121421140a6c8f2f46839c3abc38
amuzzy/python
/Project Euler/Problem0005.py
1,137
3.515625
4
## Project Euler Problem 5 ## ## 2520 is the smallest number that can be divided by each of the numbers from ## 1 to 10 without any remainder. What is the smallest positive number that ## is evenly divisible by all of the numbers from 1 to 20. ## ## Answer: 232792560 def Problem5(): x = 0 while x != -1: ...
7beedc971e201dd7465094c255592c3858275d3d
Ry-Mu/python_Algos
/algosLevel1/gcd_Recursion.py
556
3.9375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 27 19:14:40 2017 @author: RyanMunguia """ def gcd_rec(x,y, low = 0): if low == 0: if (x < y): low = x else: low = y if ((x % low) == 0) and ((y % low) == 0): print("Eureka! I think we fou...
e4c441d3cf01c4949457de145ce0e2b657cc28d6
bcostlow/cwg_class_session_one
/demo/funcs/lambda.py
637
4.15625
4
# Don't get excited, not real lambda. # Inline anonymous function. One line, One statement. # These are the same. def add_two(x): return x + 2 # But don't do this one! another_add_2 = lambda x: x + 2 vals = [1, 2, 3] multiplied = map(lambda x: x + 2, vals) also_multiplied = [x + 2 for x in vals] # comprehensio...
82080091b83c9d5bc29d5c1e161aa5efaa7a28cd
fpavanetti/python_lista_de_exercicios
/aula12_ex46.py
1,483
4.03125
4
''' DESAFIO 46 - GAME: Pedra Papel e Tesoura Crie um programa que faça o computador JOGAR Jokenpô com você. ''' from random import randint from time import sleep print("\033[1mVamos jogar Jokenpô com o computador!\033[m") print("PAPEL: [1]\n" "PEDRA: [2]\n" "TESOURA: [3]") escolha = int...
6dc533f74d13b72f32151d9cacac66674d5f9355
sciftcigit/DERS-ORNEKLER-PYTHON-I-2020
/dortislem.py
409
4.09375
4
# dört işlem yapan kodu yazalım sayi1 = input("Sayı 1 : ") sayi2 = input("Sayı 2 : ") islem = input(" Yapılacak işlemi giriniz (+ - / *) : ") if (islem == "+"): sonuc = int(sayi1) + int(sayi2) elif (islem =="-") : sonuc = int(sayi1) - int(sayi2) elif (islem =="*") : sonuc = int(sayi1) * int(sayi2) elif (i...
95d05942f7a022c1288129becde1bbf9ecaad288
RobertHan96/programmers_algorithm
/LV.1/없는 숫자 더하기.py
475
3.59375
4
# 0부터 9까지의 숫자 중 일부가 들어있는 정수 배열 numbers가 매개변수로 주어집니다. # numbers에서 찾을 수 없는 0부터 9까지의 숫자를 모두 찾아 더한 수를 return 하도록 # solution 함수를 완성해주세요. def solution(numbers): answer = sum(range(10)) ref = list(range(10)) for i in numbers : if i in ref : answer -= i return answer tabs = [1,2,3,4,6,7,...
fcc0aeb4d6cdb49ccd183fabfc55aea2d91777fb
filyovaaleksandravl/geek-python
/lesson01_DZ/01_variables.py
211
3.8125
4
var_1 = 5 var_2 = 10 print(var_1, var_2) username = input("Введите имя: ") age = int(input("Введите возраст")) print("Привет {}! Тебе {} лет.".format(username, age))
d4a6a653e086b5d0ea12aac12be537f9ebaf0126
EC500team13/Hackathons
/mini_chat/client/window_chat.py
3,060
3.609375
4
from tkinter import Toplevel from tkinter.scrolledtext import ScrolledText from tkinter import Text from tkinter import Button from tkinter import END from tkinter import UNITS from time import localtime,strftime,time #We cannot use class WindowChat(TK), beacuse only one root window is allowed #but we can have...
be80bdae2ba9d706cd23a5537a09a9ee6d9f0588
Sujit-sahoo3571/python_programming
/fileproblem1searchstr.py
152
3.703125
4
with open('another.txt','r') as f : a = f.read() if 'new' in a : print('new is present in text ') else: print('new is not present in text ')
e9192c4a08c8f8ba95193acb324a3d7efe85c5f6
michael-0115/AlgorithmsAndDataStructures
/000_Python_Programming/002_Building User-Defined Python Classes and Methods/task2.py
5,698
4.09375
4
from task1 import StringClass #Importing StringClass class StringListClass: #Create StringListClass def __init__(self, size): self.str_list = [None]*size #Get the size from user input and initial a empty list with fixed size. self.count2 = int() #Define a int...
e05a717240702c9de6db42e710d0b2f23f18ef95
addherbs/LeetCode
/Medium/537. Complex Number Multiplication.py
1,508
4.1875
4
# 537. Complex Number Multiplication # Medium # # Given two strings representing two complex numbers. # # You need to return a string representing their multiplication. Note i2 = -1 according to the definition. # # Example 1: # Input: "1+1i", "1+1i" # Output: "0+2i" # Explanation: (1 + i) * (1 + i) = 1 + i2 + 2 * i = 2...
3f9aaaf9ae2df20fe9407512c6c368b427a259a1
whwndgus001/python-basics
/03/01.symbol_table.py
1,100
3.796875
4
# global, local 심볼테이블 확인 g_a = 1 g_s = '마이콜' def g_f(): l_a = 2 l_s = '둘리' a = 2 print(locals()) print('===== Gloval Symbol Table VS Local Symbol Table =====') print(globals()) g_f() print(g_a) #error : loca_symbol table은 함수가 실행이 끝나면 사라진다. # print(l_a) print("===== Object's Symbol Table =====") # 1...
77375eb7a6c96e56b69a5b72fd459e96043f7519
gombleon/python-coursera
/price.py
108
3.546875
4
price = float(input()) rubles = int(price) penny = int(round(price - rubles, 2) * 100) print(rubles, penny)
ff321e629b4b7dfff0ebc98f33edf1a7a1f20a76
rhps/ProjectEuler.net
/Problem37-TrunctablePrimes.py
830
3.765625
4
def isprime(n): n = abs(int(n)) if n < 2: return False if n == 2: return True if not n & 1: return False for x in range(3, int(n ** 0.5) + 1, 2): if n % x == 0: return False return True def trunctleft(num): x = list(str(num)) for n in xrange(1,len(x...
b75707166cc22ea6c1d4bab7720c1fd10b82b323
hotcoffeehero/100_Days_Of_Python
/Day_4/04_banker_roulette.py
497
3.890625
4
import random names = input("Party of how many? Give me a list of names, please.\n") if names.find(", ") != -1: namesStr = names.split(", ") namesInt= len(names.split(", ")) randomCard = random.randint((namesInt - namesInt), (namesInt - 1)) shortStraw = namesStr[randomCard] print(f"It looks like {shor...
6d9759225251849d09faf985d61d7cccdfa86e77
stnh001/pythonspace
/day02/03 while else.py
293
3.78125
4
#!/usr/bin/python # -*- coding:utf-8 -*- # @Time : 2018/11/11 9:13 # @Author : liaochao # @File : 03 while else.py count = 0 while count<=5: count+=1 if count == 3:break print('Loop',count) else: print('循环正常执行完啦') print('---------------out of while ;oop')
11ee16815052849c6d78570b7941037ba1460aa2
marutibhosale/python-devops
/functional_programs/euclidean_distance.py
1,217
3.75
4
""" author -Maruti Bhosale date -12-11-2020 time -16:30 package -functional_programs Statement -finding distance between origin and given point """ import math class EuclideanDistance: def __init__(self, x_coordinator, y_coordinator): """ define constructor :param x_coordinator: x-coordi...
15d779a89c6f3a46df118c83effc711a2a82d185
niccolo-fato/projects_python
/project1/class_students.py
1,196
4.03125
4
class students: name = [] surname = [] age = [] address = [] #Constructor def __init__(self,name,surname,age,address): self.name.append(name) self.surname.append(surname) self.age.append(age) self.address.append(address) #Method to search for a student and pr...
67fd823d8448659eb276533bcbc19ca55fc4c071
pedrojperez1/flask-madlibs
/app.py
791
3.71875
4
from flask import Flask, request, render_template from stories import Story app = Flask(__name__) story = Story( ["place", "noun", "verb", "adjective", "plural_noun"], """ Once upon a time in 18th century {place}, there lived a {adjective} {noun}. It loved to {verb} with {plural_noun}. The p...
1aa7c06de542afdfedd6243053db6bf0781045f6
Diogogrosario/FEUP-FPRO
/RE07/triplet.py
538
3.859375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 15 09:11:36 2018 @author: diogo """ def triplet(atuple): for i in range(len(atuple)): for j in range(len(atuple)): for k in range(len(atuple)): if atuple[i]+atuple[j]+atuple[k] == 0 and i!=j!=k: ...
372a917767ca83a46d49c68ac439d65922babc6c
rennanmserenza/PY_Calc
/classe_calculadora.py
4,529
3.796875
4
import re import math import tkinter as tk from typing import List class Calculadora(): def __init__( # Parâmetros iniciais do nosso objeto self, root: tk.Tk, label: tk.Label, display: tk.Entry, buttons: List[List[tk.Button]] ...
afefecd33a4a58af1e7650af643421fdd67ac8dc
augustusbd/work-scheduler
/scheduler.py
3,567
3.53125
4
# Python Imports from random import randint class Scheduler(): def __init__(self): self._weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] self._headings = [''] + self._weekdays # empty space for axis titles self._days = 7 self.total_shifts = ...
3b5f878be800e379c342fd65911f21a5ddc9cc8c
Prem38sri/Python_machine_test
/binary_reduced_to_zero.py
1,083
3.53125
4
import datetime # brute force def solution(S): a = datetime.datetime.now() # write your code in Python 3.6 dec = 0 for j in S: dec = dec * 2 + int(j) #print(dec) i = 0 while dec > 0: if dec % 2 == 0: dec //= 2 #print(dec) else: d...