max_stars_repo_path null | max_stars_repo_name null | max_stars_count null | id null | text string | score float64 | int_score int64 | from string | blob_id string | repo_name string | path string | length_bytes int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|
null | null | null | null | #Python Program to Display the multiplication Table
print("ENTER NUMBER FOR CACULATE MULTIPLICATION TABLE")
var1=int(input())
i=1
while(i<=10):
res=int(var1)*int(i)
print(var1,"*",i,"=",res,"\n")
i=i+1
| 4.4375 | 4 | smollm | e4abe21c4a158dbf1381926f63cce2925edc4fea | The-Smashers-Design/multiplication-Table.github.io | /NINE.py | 230 |
null | null | null | null | OKONOMIYAKI_MENU = {
'Aใกใใฅใผ': {'ใใก', 'ๆๅคชๅญ', '่ฑ่'},
'Bใกใใฅใผ': {'ใญใ ใ', 'ๆๅคชๅญ', '็่'},
'Cใกใใฅใผ': {'ใใผใบ', 'ๅคฉใใ', '็่'},
'Dใกใใฅใผ': {'ใใก', 'ใใผใบ', 'ใคใซ'},
}
def output_complement_menu(want_to_eat):
for menu_name, gu_set in OKONOMIYAKI_MENU.items():
gu_issubset = want_to_eat <= gu_set # ้ฃในใใใ... | 3.53125 | 4 | smollm | 55eb46725962e31c569c37e8789eed0dfa59760f | Hiroto710281/Okonomiyaki_Menu | /Okonomiyaki_Menu.py | 1,265 |
null | null | null | null | print(''' 5. ะัะธ ะฟะพะผะพัะธ ัะธะบะปะพะฒ ะธ ะปะพะณะธะบะธ ัะตะฐะปะธะทะพะฒะฐัั ะฒัะฒะพะด ะฒ ะบะพะฝัะพะปั ัะธะณััั ะฟะตัะพัะฝัั
ัะฐัะพะฒ ะธะท ัะธะผะฒะพะปะพะฒ "*",
ะฟะพะปัะทะพะฒะฐัะตะปั ะทะฐะดะฐัั ะฒััะพัั ะธ ัะธัะธะฝั(ะฒ ะบะพะปะธัะตััะฒะต ัะปะตะผะตะฝัะพะฒ).
ะัะธะผะตัะฐะฝะธะต: ัะธัะปะฐ, ะฒะฒะพะดะธะผัะต ะฟะพะปัะทะพะฒะฐัะตะปะตะผ ะดะพะปะถะฝั ะฑััั ัััะฝัะผะธ ะดะปั ะบะพััะตะบัะฝะพะน -"ะพััะธัะพะฒะบะธ".
''')
import numpy
while True:
try:
n = int(inp... | 4.03125 | 4 | smollm | b4d6e950e768099470f0ab2163e49a96c6d8c8cd | LoyalSkm/Home_work_2_base | /hw2_task_5.py | 1,692 |
null | null | null | null | def q1_a(i1, i2):
items = [4, 5, 6, 8]
result = items[i1] * items[i2]
return result
def q1_b():
names = ["apples" , "bananas", "grapes"]
values = [5, 3, 7]
for idx, name in enumerate(names):
if name == "apples":
return values[idx]
else:
return None
def q1_c():
d = {"apples" : ... | 3.75 | 4 | smollm | 48762a2476746ae43c6d40624178877527d66db4 | KocUniversity/COMP100-2021S-Week10-StudyQuestions | /q1.py | 1,656 |
null | null | null | null | #!/usr/bin/env python
import sys
def main():
if len(sys.argv) < 4:
print "Usage:", sys.argv[0], "<mode> <key> <input>"
print " <mode> can be 'encrypt'/'e' or 'decrypt'/'d'"
print " <key> is the encryption/decryption key"
print " <input> plaintext/ciphertext"
... | 3.734375 | 4 | smollm | 5e3d5c8a99d5fa409732882f66ec3c1a079dd188 | viren-nadkarni/codu | /ccns/transposition.py | 1,319 |
null | null | null | null | # Sorting a List using Quicksort in Python
# 2011-05-16
def quickSort(toSort):
if len(toSort) <= 1:
return toSort
end = len(toSort) - 1
pivot = toSort[end]
low = []
high = []
for num in toSort[:end]:
if num <= pivot:
low.append(num)
else:
high.append(num)
sortedList = quickSort(low)
sortedLi... | 4.03125 | 4 | smollm | 48b22ecf30770a737885664b5f0dca66c9fd82eb | viren-nadkarni/codu | /madf/qs.py | 536 |
null | null | null | null | score = input("Enter score between 0.1 and 1.0:")
if float(score) > 1.0 or float(score) < 0.0 :
print("Score out of range!")
if float(score) >= 0.9 :
print("A")
elif float(score) >= 0.8 :
print("B")
elif float(score) >= 0.7 :
print("C")
elif float(score) >= 0.6 :
print("D")
elif float(score) < 0.... | 3.984375 | 4 | smollm | 508640c5384ee8e87acf75f6cdc37236b4b99df1 | crash48/python-class | /assignment3_3.py | 339 |
null | null | null | null | # Date created: 23/01/2019
# Dice rolling simulation
from random import randrange
cont = 1
while cont == 1:
print("Roll dice: ", randrange(1,7,1))
cont = int(input("Continue? 0/1 "))
while cont != 0 and cont != 1:
print("Input invalid")
cont = int(input("Continue? 0/1 "))
| 3.6875 | 4 | smollm | b1429e355b5fe50fbee168f41d5a477ebd71de13 | NhanNgocThien/IlearnPython | /dice_rolling.py | 303 |
null | null | null | null | #This program adds twelves student name and their average grades
#to grades.txt file
def main():
#open and write student grades.txt file
try:
student_grade = open('grades.txt', 'w')
#create a for loop
for students in range(12):
#Get student name
... | 4.21875 | 4 | smollm | 7cae26c784017ac8402f8d80d72cebcb539870b2 | sharlenemutto/Big-Data | /Student Data.py | 1,764 |
null | null | null | null | #!/usr/local/bin/python3
import os
def rename():
path = os.path.abspath('.') # ่ทๅพๅฝๅๅทฅไฝ็ฎๅฝ
filelist = os.listdir(path) # ่ฏฅๆไปถๅคนไธๆๆ็ๆไปถ๏ผๅ
ๆฌๆไปถๅคน๏ผ
for files in filelist: # ้ๅๆๆๆไปถ
Olddir = os.path.join(path, files) # ๅๆฅ็ๆไปถ่ทฏๅพ
if os.path.isdir(Olddir): # ๅฆๆๆฏๆไปถๅคนๅ่ทณ่ฟ
continue
... | 3.546875 | 4 | smollm | 50aa78f15817ad87ab8342ddd73252e42ea68a37 | xuchengcan/MyPythonDemo | /rename.py | 1,281 |
null | null | null | null | #Simple GUI test
# import all tkinter in the program's global scope
from tkinter import *
# import requests for the http fetch
import requests
# create a root window
root = Tk()
#modify the window
root.title("Simple GUI")
root.geometry("200x100")
#create frame in the window to hold other widgets
app = Frame(root)
#invo... | 3.609375 | 4 | smollm | 707af793ad820c69cf7cec40b8cd9919026e2fef | Pacane99/Test-Public | /simpleGUI.py | 1,097 |
null | null | null | null | mensaje='hola'
print(mensaje)
class miClase:
def __init__(self,a,b):
self.a=a
self.b=b
def valor(self):
return self.a+self.b
#esto es un comentario
a=1
print (id(a))
a +=2
print(id(a))
| 3.546875 | 4 | smollm | 8639787d174d85b1bd6e788e89762d2e027bc525 | rodrigosecko/python | /src/repaso.py | 229 |
null | null | null | null | s = set()
s.add(1)
s.add(3)
s.add(3)
s.add(5)
# Output is {1, 3, 5}
# If we add number which is in the set already it will be printed once
# The sets have unique values
print(s) | 4.03125 | 4 | smollm | a51b482d9987b524d8ac89986cecffc6126667aa | MarianKanev/lecture1 | /sets.py | 177 |
null | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 19 17:05:20 2020
@author: Mabel
referenced from Ken Jee - Github username: PlayingNumbers
url: https://github.com/PlayingNumbers/ds_salary_proj
"""
import pandas as pd
pd.set_option('display.max_columns', None) # display all columns in Pycharm
dataFrame = pd.read_csv('g... | 3.859375 | 4 | smollm | aa5a8e84ab66aa0d4b8cc1e2eb4adfd72d9def57 | mabelleky/data_science_salary_predictor | /data_cleaning.py | 4,332 |
null | null | null | null | import scipy
import networkx
import pandas
import pdb
class FabNetwork(object):
def __init__(self, distData):
self.distData = pandas.read_csv(distData)
self.fromNode = self.distData.From
self.toNode = self.distData.To
self.time = self.distData.Time
#We d... | 3.546875 | 4 | smollm | ea148afad310703280de204dad97dfdf32dbf4f8 | shreyagupta/PhD_Dissertation | /FabConstructorDDD4.py | 6,041 |
null | null | null | null |
from tkinter import *
import sys
import logging
import pymysql
from school import Student
# global instance
# student = Student()
class Credentials(Frame):
"""Create a login frame that opens database upon
successful login or prints relevant message if credentials are
incorrect """
def __init__(sel... | 3.578125 | 4 | smollm | 295a7170d92439a92631a48539060d329f7262cd | Wangenye/school_database_system | /database_login.py | 2,825 |
null | null | null | null | #!/bin/usr/env python3
# -*- coding: utf-8 -*-
# -------------------------------
# Author: SuphxLin
# CreateTime: 2020/07/22 12:18
# FileName: 2048_tkinter.py
# Description:
# Question:
import random
import copy
# ๆฃ็ๅๅงๅ
board = [[0, 0, 0, 0] for i in range(4)]
# ๅๆฐๅๅงๅ
score = 0
# ้็ฝฎ
def reset():
# ๅๆฐๆธ
0
glob... | 3.53125 | 4 | smollm | 102b243eee4133b1f75d06796c48c3093653745c | Suphx/python_project_repository | /01.BoardGame/05.2048/2048_tkinter.py | 7,439 |
null | null | null | null | #!/bin/usr/env python3
# -*- coding: utf-8 -*-
# -------------------------------
# Author: SuphxLin
# CreateTime: 2020/8/4 15:08
# FileName: 03.HotDog
# Description:
# Question:
class HotDog:
def __init__(self):
self.cooked_level = 0
self.cooked_string = "็็"
self.condiments = []
def ... | 3.875 | 4 | smollm | 4c531727d6f28d4233e01638979a773da207fd4b | Suphx/python_project_repository | /06.Python Basic/01.Object Oriented/03.HotDog.py | 1,304 |
null | null | null | null | #!/bin/usr/env python3
# -*- coding: utf-8 -*-
# -------------------------------
# Author: SuphxLin
# CreateTime: 2020/07/22 12:11
# FileName: 2048_terminal.py
# Description:
# Question:
#
# 2048
# 1. ๅๅงๅไธไธช4*4็ๆฃ็
# ๅฃฐๆboardใshowไธบๅ
จๅฑๅ้
global board, show
board = [[0, 0, 0, 0] for i in range(4)]
show = [[0, 0, 0, 0] for ... | 3.8125 | 4 | smollm | 3243d0505dd1e9e465409d2e7342a9076e3bfb1d | Suphx/python_project_repository | /01.BoardGame/05.2048/2048_terminal.py | 2,871 |
null | null | null | null | import matplotlib.pyplot as plt
from get_train_info import get_class_per_image
def plot_class_per_image_hist(df_train):
"""
Function that plots histograms of label patterns & number of labels
per images (for the Kaggle cloud classification competition project).
Parameters
----------
df_train:... | 3.515625 | 4 | smollm | a5477271fa7c96c61175cd6e792b7de87fcf6f07 | Team-Cloudbusters/cloudbusting | /lib/cloudbusting/EDA/plot_EDA.py | 1,760 |
null | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
a = 10 / 3
b = 10 // 3
c = 10 % 3
d = 10 / 3.0
e = 10 // 3.0
f = 10.5 % 3.0
print(a, b, c)
print(d, e, f)
print("-----------------------")
str1 = r"this is \a \string! \n and you is son of beach!"
str2 = "this is \a \string! \n and you is son of beach! hahaha\n"
print... | 4.125 | 4 | smollm | fbb42c4f19f45eee93eace4e19d84a733f782d14 | redhead520/LearningCode | /python/demo/01.dataStructure-demo/01.dataStructure-demo.py | 430 |
null | null | null | null | import pygame
pygame.init()
screen = pygame.display.set_mode((480, 700))#ๅๅปบๆธธๆไธป็ชๅฃ
bg = pygame.image.load("./images/background.png")#็ปๅถ่ๆฏๅพ ๅ ่ฝฝๅพๅ
screen.blit(bg, (0, 0))#็ปๅถๅจๅฑๅน
#pygame.display.update()#ๆดๆฐๆพ็คบ
hero=pygame.image.load('./images/hero.gif')#ๅ ่ฝฝๅพๅ
screen.blit(hero,(200,500))#็ปๅถๅฑๅน็ไปไนไฝ็ฝฎ
pygame.display.update()#ๆดๆฐ... | 3.53125 | 4 | smollm | de3fab9c065c1088c3b46443559eaee139da677b | ZiHaoYa/1807-2 | /08day/02-้ฃๆบๅคงๆ.py | 1,280 |
null | null | null | null | import math
inFile = open("input.txt", "r")
outFile = open("output.txt", "w")
def getSpace(desired, length):
space = ""
for i in range(0, (desired - length)):
space += " "
return space
charCount = 0
dictionary = {}
discluded = ["\n", " "]
print("Reading Input File.")
for line in inFile:
for c... | 3.546875 | 4 | smollm | 25ce22bcd4b248e6baf3b655d2f120d6eec7bc34 | andyruwruw-old/coding-challenge-for-kids | /Labs_Python/3._Advanced_Python/2._Input_and_Output_Files/Character_Frequencies/solution.py | 1,248 |
null | null | null | null | class WaterBottle:
def __init__(self, color, capacity, volume):
self.color = color
self.capacity = capacity
self.volume = volume
def drink(self, amount):
self.volume -= amount
if self.volume < 0:
self.volume = 0
def refill(self, amount):
self... | 3.796875 | 4 | smollm | 8c6fc5017958a2c8c0c08de409aacb53284d382e | andyruwruw-old/coding-challenge-for-kids | /Labs_Python/2._Intermediate_Python/2._Objects_and_Classes/Water_Bottle_Object/solution.py | 727 |
null | null | null | null | sentence = "" # Place the sentence here.
lastWord = ""
result = ""
for word in sentence.split():
if word != lastWord:
result += word + " "
lastWord = word
print(result)
| 4.03125 | 4 | smollm | 342cb7cdcc69c48b5d54fc6edd6c98aad0948bb9 | andyruwruw-old/coding-challenge-for-kids | /Labs_Python/2._Intermediate_Python/1._Strings/Repeating_Words/solution.py | 192 |
null | null | null | null | import numpy
import csv
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def view_pc(pcs, fig=None, color='b', marker='o'):
"""Visualize a pc.
inputs:
pc - a list of numpy 3 x 1 matrices that represent the points.
color - specifies the color of each point cloud.
... | 3.546875 | 4 | smollm | 1db7f92153daf022ee54243189c922f697144b49 | cxchance/Algorithmic-Robotics | /utils2d.py | 5,361 |
null | null | null | null | import numpy
def circle(radius, size, circle_centre=(0, 0), origin="middle"):
"""
Create a 2-D array: elements equal 1 within a circle and 0 outside.
The default centre of the coordinate system is in the middle of the array:
circle_centre=(0,0), origin="middle"
This means:
if size is odd : t... | 4.53125 | 5 | smollm | 08964e794e1436aa0e6c2faeb95100652bf0a8aa | agb32/aotools | /aotools/functions/pupil.py | 3,494 |
null | null | null | null |
#print exercise and f exercise
my_name = 'super xiang'
my_age = 35 # really
my_height = 172 # cm
my_weight = 70 #kg
print(f"The boy's name is {my_name}, ")
print(f"he is {my_age} years old, {my_height} cm height, and {my_weight} kgs weight.")
print (f"My name is {my_name}")
print (f"I am {my_age} years old, {my_h... | 4 | 4 | smollm | 6bbb311e2d911a7ce8869adaf8b2af204e3895ca | superxiangsx/python-ex | /ex5.py | 362 |
null | null | null | null | import sys
import random
import myfuncs
class FlashCard:
def __init__(self, question, answer):
self.question = question
self.answer = answer
def getQuestion(self):
return self.question
def getAnswer(self):
return self.answer
class FlashCardSet:
def __init__(self, fi... | 3.5625 | 4 | smollm | 9728f668f6e4dfbbf60768dea262bc851c56b64c | DrNightmare/flashcards | /flashcards.py | 2,772 |
null | null | null | null | import time
choose=input("Plese enter 'E' if you want to Encrypt and 'D' if you want to Decrypt:")
#We will ask User to Enter E for Encryption and D for Decryption into variable Choose
if choose=='E':
key=input("Please Enter the secret Key:")
key=key.upper()
keylist=[]
ciphertext=[]
keymatrix=[]
... | 4.09375 | 4 | smollm | dfc3588a2e1957dcbbb363e9e75397224090db79 | SIDDHARTHSS93/Computer-Security-Assignments | /1802772/PlayFair/playfair18812.py | 8,361 |
null | null | null | null | def getLotteryPrizings():
numbers = input("Enter Values separated by commas ");
people = input("Enter participants names ");
#convert to list
numbersList = list(numbers)
peopleList = list(people)
peopleNumber = len(peopleList)
numberListTotal = 0
for i in numbersList:
numberListTota... | 3.96875 | 4 | smollm | 74315ced7ff681627a23317aeb22808dae287aba | mayreeh/Lottery | /Quiz.py | 1,303 |
null | null | null | null | class Product:
def __init__(self, name, price, owner=None, release=None):
self.name = name
self.price = price
self.owner = owner
self.release = release
def __repr__(self):
return f"{self.__class__.__name__}{self.name, self.price}"
if __name__ == "__main__":
iphone ... | 3.5625 | 4 | smollm | 638746a93b3d8b9dca38787301df51dce1429b81 | NagahShinawy/dev.to | /tips-tricks/4-comp.py | 803 |
null | null | null | null | # https://dev.to/natec425/inspecting-function-annotations-in-python-1hfd
import inspect
users = [
{"username": "john", "password": "123456"},
{"username": "loen", "password": "123456"},
{"username": "smith", "password": "123456"},
]
def login(username: str, password: str) -> bool:
for user in users:... | 3.828125 | 4 | smollm | 22a08c6eec4cb06d758ed873857b68f6d95efbd0 | NagahShinawy/dev.to | /advanced-python/inspecting-function-annotations-in-python-1hfd.py | 821 |
null | null | null | null | def trace_of_matrix(order,matrix):
trace=0
for i in range(order):
trace += matrix[i][i]
return trace
NUM_ROWS = 25
NUM_COLS = 25
# construct a matrix
my_matrix = []
for row in range(NUM_ROWS):
new_row = []
for col in range(NUM_COLS):
new_row.append(row * col)
my_matrix.... | 3.703125 | 4 | smollm | 8d6a57e58c126d6bec3153ea5bc44135b3e9f200 | NamitaKalra/PractisePgms | /Trace_Matrix.py | 386 |
null | null | null | null | def payingOffInAyear(balance, annualInterestRate):
monthlyInterestRate = annualInterestRate / 12
payment = 10
while balance > 0:
bal = balance
for i in range(12):
unpaidBalance = bal - payment
bal = unpaidBalance + unpaidBalance*monthlyInterestRate
if bal <= 0... | 3.65625 | 4 | smollm | ca7f76acc2fbd0ae6597078708b9dacaa96a7258 | dsweed12/My-Projects | /Project II - Python MITx/venv/problem set 2/problem 2.py | 434 |
null | null | null | null | from random import randint
GREETING = 'What number is missing in the progression?'
length_progression = 10
def generate_data():
start = randint(1, 10)
step = randint(1, 10)
hidden_number = randint(0, length_progression - 1)
question = ''
j = 0
while j < length_progression:
if question:... | 3.921875 | 4 | smollm | e14f066aedbced30d075718c0fb6f24cf285b0d8 | PolyMaG/python-project-lvl1 | /brain_games/games/progression.py | 595 |
null | null | null | null | '''
Code to create a secret santa generator
Karl Zodda
'''
## Importing packages
import random
def secret_santa(people_to_pick, people_tobe_picked):
## empty dictionary holding who has what person to keep track.
dict = {}
## Now we have two lists. One to pick and one to be picked
#While there are sti... | 4.0625 | 4 | smollm | 382ed860bc0ba4c6555a69e98cd62ea497312330 | kzodda/secret_santa | /secret_santa.py | 1,873 |
null | null | null | null | #Son listas inmutables, es decir, no se pueden modificar despues de su creacion
# no perminten aรฑadir, eliminar, mover elementos (no append, exten, remove)
# si permiten extraer porciones, pero el resultado de la extraccion es una tupla nueva
# si permiten comprobar si un elemento esta en la tupla
# nombreLiSTA=(... | 4.1875 | 4 | smollm | e82b1b5c74572b7119c916bf9e4253002603f596 | fatimaig/Python | /ejemplo4_Las tuplas.py | 1,179 |
null | null | null | null | # -*- coding: utf-8 -*-
import logging
from collections import namedtuple
Recipe = namedtuple("ClassifiedRecipe", "id, ingredients")
ClassifiedRecipe = namedtuple("ClassifiedRecipe", "id, cuisine, ingredients")
"""
Uses ingredients to categorize the cuisine of a recipe.
@author: Alan Kha
"""
class Cuisinier:
... | 3.59375 | 4 | smollm | 7decf7fa1f875c05f6fdb0eede09bc804d993342 | tracyyu/UCLA-CS-145-Cuisiner | /Cuisinier-Tracy/Cuisinier.py | 7,687 |
null | null | null | null | import math
num = int(input("Enter a number: "))
guess = int(input("Guess its square root: "))
new_guess = 0
while new_guess < (guess + .5):
quotient = num / guess
print(quotient," m")
average = (quotient + guess) / 2
new_guess = average
if(new_guess >= (guess + .5)):
print(... | 4.0625 | 4 | smollm | fd9b08cac785bb85f45d42dd13aab2ecdbec6934 | tboydv1/project_python | /practice/squareRoot.py | 383 |
null | null | null | null | import string
file_name = input("Enter file name: ")
dict_obj = open('dictionary.txt', 'w')
bad_char = string.punctuation + string.whitespace
while True:
try:
file_obj = open(file_name, 'r')
letter = ''
count = 0
for line in file_obj:
for char in line:
... | 3.53125 | 4 | smollm | ecc188ab7773345497bbc6ea10745d1f7843f1f5 | tboydv1/project_python | /Python_book_exercises/chapter5/exercise7/word_occurence.py | 538 |
null | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 19 10:54:21 2019
@author: tboydev
"""
name_str = "homebody"
print(name_str[:(name_str.find('b'))])
print(name_str[(name_str.find('b')):name_str.find('y')+1]) | 3.796875 | 4 | smollm | aad012a5511de97fc0285fcafb44f21b83202d33 | tboydv1/project_python | /Python_book_exercises/chapter4/string2.py | 229 |
null | null | null | null | #read a particular line from a file. User provides bothe the line
#numbe and the file name
file_str = input("Open what file: ")
status = True
while status:
try:
input_file = open(file_str)
find_line_str = input("Which line (integer): ")
find_line_int = int(find_line_str)
for count,... | 4.28125 | 4 | smollm | 0b4a21bbd39170d02f0cb77d8f2d1a73c7f074cc | tboydv1/project_python | /Python_book_exercises/chapter5/examples/exception_handling.py | 942 |
null | null | null | null | #Anagram test
def are_anagrams(word1, word2):
"""Return true if words are not anagrams"""
word1_sorted = sorted(word1)
word2_sorted = sorted(word2)
return word1_sorted == word2_sorted
print("Anagram Test")
#validate user input
valid_input = False
while(not valid_input):
try:
two_word = ... | 4.34375 | 4 | smollm | 2a852e6885e008fd7a2dac97172feeebe3489fb4 | tboydv1/project_python | /Python_book_exercises/chapter7/examples/Anagram_test.py | 657 |
null | null | null | null | #classify a range of numbers with respect to perfect, abundant or deficient
top_num = int(input("What is the upper number for the range: "))
number = 2
while number <= top_num:
#sum the divisors of the number
divisor = 1
sum_of_divisors = 0
while divisor < number:
if number % ... | 3.953125 | 4 | smollm | 3044e68af4494f010d8ebbd1b960a631e6bfdd00 | tboydv1/project_python | /Python_book_exercises/chapter1/classifyInt.py | 695 |
null | null | null | null | #Body mass index calculator
## prompt for metrics weight and height
weight = int(input("Enter weigth in kilograms "))
height = int(input("Enter heigth in meteres "))
BMI = weight / (height**2)
print("Body mass index is: ", BMI)
| 4.1875 | 4 | smollm | 4579f5cb3cc38dfcf56785cb85b7935aa687b2b8 | tboydv1/project_python | /Python_book_exercises/chapter1/BMI_calculator.py | 234 |
null | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 14 15:16:18 2019
@author: tboydev
"""
def celcius_to_fahrenheit(celcius_float):
"""Convert Celsius to Fahrenheit"""
return celcius_float * 1.8 + 32
| 3.703125 | 4 | smollm | 8f172b0ed5edaf81b5e1e351b7a8faac4c78f4a6 | tboydv1/project_python | /Python_book_exercises/chapter1/temperature.py | 223 |
null | null | null | null | #importing the necessary libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#reading the csv file
yelp_df = pd.read_csv("yelp.csv")
#description of yelp dataset
yelp_df.describe()
#some more information on the yelp dataset
yelp_df.info() #There is no missing dat... | 3.765625 | 4 | smollm | a5e426073e06007a83bcdceb622a571797a02a78 | SujayDas1999/Yelp-review-classification- | /yelp_review_classification.py | 3,846 |
null | null | null | null |
# def my_function(str1, str2):
# print('This is my function!')
# print(str1)
# print(str2)
# my_function('hello', 'world')
# def print_something(name="Jonny", age=50):
# print('My name is', name, ' and my age is ', age)
# print_something(age=32)
# def print_people(*people):
# for person in ... | 3.84375 | 4 | smollm | eedb068d426db3e062c422820cd8d08466f9fa44 | jonnysfarmer/python-learning | /main.py | 1,225 |
null | null | null | null | """$$$ datatypes(17) $$$"""
"""int,float,string,none,bool,list,set,dictionary,string"""
"""int datatype"""
# n=2;m=3;o=5
# print(n,type(n))
# print(m,type(m))
# print(o,type(o))
"""convert int-->float"""
# a=12
# print(a)
# print(int(a))
# print(float(a))
"""float datatype"""
# p=2.3;q=3.4;... | 4.03125 | 4 | smollm | 81a8392519494f877be2ca6271b0dc1c9ebb2c28 | sree-07/PYTHON | /data types.py | 18,266 |
null | null | null | null |
class Player:
def __init__(self, name, age, country, chips):
self.name = name
self.age = age
self.country = country
self.chips = chips
self.bet = 0
self.__hand = []
self.__value = 0
self.stand = False
self.won = False
sel... | 3.5 | 4 | smollm | 3454f1a2e85eb63ea875ebdc3d63d419c773f721 | mariantirlea/python-blackjack | /entity/Player.py | 1,852 |
null | null | null | null | ๏ปฟ# -*- coding:utf-8 -*-
import random
secret = random.randint(1,10)
temp = input("่ฏท่พๅ
ฅไธไธช10ไปฅๅ
็ๆฐๅญ๏ผ")
while temp.isdigit() != True:
temp = input("ไฝ ็่พๅ
ฅๆ่ฏฏ๏ผ่ฏท่พๅ
ฅไธไธช10ไปฅๅ
็ๆฐๅญ๏ผ")
guess = int(temp)
while guess < 0 or guess > 10 :
temp = input("ไฝ ่พๅ
ฅ็่ๅดไธๅฏนๅฆ๏ผ่ฏท่พๅ
ฅไธไธช10ไปฅๅ
็ๆฐๅญ๏ผ")
guess = int(temp)
t = 0
if guess == secret:
print("ๅคชๅๅฎณไบ!")
... | 3.578125 | 4 | smollm | 37dd22aa8cca15c9c0eee5c3b618fd93669b0291 | javenxww/Python_Study_Recode | /WordGame/WordGame.py | 887 |
null | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 9 19:22:40 2018
@author: virajdeshwal
"""
print('Lets begin with the Kmeans Clustering.\n')
#intake = input('Press any key to continue....\n\n')
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
file = pd.read_csv('Mall_Cust... | 3.90625 | 4 | smollm | d64b781daefef1110feddb5e2744a760069ebee6 | VirajDeshwal/KMeans-Clustering | /KmeansClustering.py | 2,094 |
null | null | null | null |
class Node():
def __init__(self, _data, _next):
self.data = _data
self.next = _next
class LinkedList():
def __init__(self, _list):
self.head = None
self.tail = None
self.count = None
for i in _list:
self.append(i)
... | 3.71875 | 4 | smollm | 6fb8797f42744798083c7eb456f3c97a66a6e3e3 | ramu-jan23/Competitive-Programming | /linkedlist.py | 5,824 |
null | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Determine if rectangles overlap.
"""
import collections
Point = collections.namedtuple('Point', 'x y')
class Rectangle(object):
def __init__(self, min_x=None, max_x=None, min_y=None, max_y=None):
for coord in (min_x, max_x, min_y, max_y):
if c... | 4.03125 | 4 | smollm | 769ad3f5fd085f96fdba74053b2182d4911590b0 | jpowerwa/coding-examples | /overlapping_rectangles.py | 4,049 |
null | null | null | null | #Given an array of strings, group anagrams together.
#
#
#For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"],
#Return:
#
#[
# ["ate", "eat","tea"],
# ["nat","tan"],
# ["bat"]
#]
#
#Note: All inputs will be in lower-case.
class Solution(object):
def groupAnagrams(self, strs):
"... | 3.828125 | 4 | smollm | 4947ec1842adb95ace0097ad356ca6831b294f72 | zhongpei0820/LeetCode-Solution | /Python/1-99/049_Group_Anagrams.py | 1,478 |
null | null | null | null | #
#Find the contiguous subarray within an array (containing at least one number) which has the largest product.
#
#
#
#For example, given the array [2,3,-2,4],
#the contiguous subarray [2,3] has the largest product = 6.
#
class Solution(object):
def maxProduct(self, nums):
"""
:type nums:... | 3.859375 | 4 | smollm | f2f6a4e8972c9d61a9e1938033e8314d6fb2e8dc | zhongpei0820/LeetCode-Solution | /Python/100-199/152_Maximum_Product_Subarray.py | 849 |
null | null | null | null | #
#Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself). So what is the most frequent subtree sum value? If there is a tie, return all the values with t... | 4 | 4 | smollm | 0dd913e84f909c3164ed912177ee49d13bb9dad1 | zhongpei0820/LeetCode-Solution | /Python/500-599/508_Most_Frequent_Subtree_Sum.py | 1,516 |
null | null | null | null | #
#Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
#
#
#You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. ... | 4.40625 | 4 | smollm | e525d56774a95c3c003bb205aee5ac687b644937 | zhongpei0820/LeetCode-Solution | /Python/600-699/617_Merge_Two_Binary_Trees.py | 1,810 |
null | null | null | null | #Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
#
#
# For example, given array S = {-1 2 1 -4}, and target = 1.
#
# The sum that is closest t... | 3.796875 | 4 | smollm | f451f7b16b7d54fe3659c61652461770796d7781 | zhongpei0820/LeetCode-Solution | /Python/1-99/016_3Sum_Closest.py | 1,367 |
null | null | null | null | #Given a non-empty array of numbers, a0, a1, a2, โฆ , an-1, where 0 ≤ ai < 231.
#
#Find the maximum result of ai XOR aj, where 0 ≤ i, j < n.
#
#Could you do this in O(n) runtime?
#
#Example:
#
#Input: [3, 10, 5, 25, 2, 8]
#
#Output: 28
#
#Explanation: The maximum result is 5 ^ 25 = 28.
#
#
class ... | 3.515625 | 4 | smollm | 2cc84859e76700d76f17259ac1dfb8e0cfdd747d | zhongpei0820/LeetCode-Solution | /Python/400-499/421_Maximum_XOR_of_Two_Numbers_in_an_Array.py | 803 |
null | null | null | null | #
#Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen, which consist of minimum of m keys and maximum n keys.
#
#Rules for a valid pattern:
#
#Each pattern must connect at least m keys and at most n keys... | 3.6875 | 4 | smollm | 5dad91f25be1225d7a8acb4e0aa4361db0d0dcf1 | zhongpei0820/LeetCode-Solution | /Python/300-399/351_Android_Unlock_Patterns.py | 2,493 |
null | null | null | null | #!/usr/bin/env python
import random
class Maths:
"""Static mathematical helper functions for RSA encryption"""
@staticmethod
def probably_prime(p):
"""Fermat's Primality Test"""
for i in range(0, 50):
a = random.randint(2, p-1)
if Maths.powermod(a, (p - 1), p) != 1... | 3.859375 | 4 | smollm | 5692cda5ac34699078b3d1555d54d1d17e2fa701 | reality/PyRSA | /maths.py | 1,833 |
null | null | null | null | def main():
users = []
activenames = []
x=0
infile = open("users.txt" ,"r")
for line in infile:
subLine = (line.rstrip()).split()
users.append(subLine)
while True:
username = input("Enter User Name: ")
password = input("Enter Password: "... | 3.6875 | 4 | smollm | 67a21872db4a07f4a3f26ebeb96a0fc5233ee476 | ntrallosgeorgios/python_Add_remove_org | /authentication.py | 882 |
null | null | null | null | from socket import * # import functions from socket module
def main():
clientSocket = clientConnection()
username = input("Enter User Name: ")
clientSocket.send(username.encode("utf-8")) # send the username in the server
password = input("Enter password: ")
clientSocket.send(usern... | 3.71875 | 4 | smollm | 312afa909bdf3a0947db1e5a2ee26bb624242fd6 | ntrallosgeorgios/python_Add_remove_org | /test/ClientNew.py | 3,995 |
null | null | null | null | import pygame
from pygame.sprite import Sprite
import game_functions as gf
class Ship(Sprite):
'''a class to manage the contents and settings of the ship'''
def __init__(self, screen):
super().__init__()
#initialize ship attributes
self.idle = pygame.image.load('images/ship_idle.png')
self.up = pygame.imag... | 3.5625 | 4 | smollm | 62b48cb89753a2e00553b2332496635358c69c09 | Defcon88/type_x | /ship.py | 1,850 |
null | null | null | null | from itertools import cycle
#itertools Pythonๆ ๅๅบ ไธ้จ็จๆฅๅๅปบ่ฟญไปฃๅจ็
import time
mylist = [1,2,3] #varไธญ็ๆฐๆฎ ๅๅณไบ ๆฅๆบ็ๆๅบๅฏน่ฑก
#mylist: ๅ่กจ ็บฟๆง็ๆนๅ
var = cycle(mylist) #ๆ ๆณๅจๆๆนๅ็
print(dir(var))
for v in var:
time.sleep(0.5)
print(v)
mystr = 'abcdefg' #C่ฏญ่จ ๅธธ้ๆ้ ๆ ๆณไฟฎๆน
#ๅบๅ็ฑปๅไผๅธฎไฝ ๅคๅๅปบไธไบ็ฉบ้ด
chr mystr[7] = "abcdefg"
#hash่กจ
#็บข้ปไบๅๆ (้พ่กจ) ้ๅๆฃ็ดข้ๅธธๅฟซ ... | 3.984375 | 4 | smollm | f77ea7de422425cfd6cf3f766082f56e528a987d | yht414802577/python | /ๅ็็ฉ็ฉ/3.py | 715 |
null | null | null | null | #funcao para determinar as relacoes
def relaciona(c1, c2):
#declara o conjunto a ser retornado
conjunto = []
#declara a variavel de decisao
val = 0
#para todo i em c1(conjunto1)
for i in c1:
#para todo x em c2(conjunto2)
for x in c2:
#pergunta ao usuario se os element... | 4 | 4 | smollm | c6b0ba367d259de97876da3aa9e327381b733dbc | toledompm/Matematica-Discreta | /programas_1_prova/composicao.py | 1,711 |
null | null | null | null | #1. Can you sort a numerical list in Python?
lst = ["5", "8", "1", "2", "10"]
lst = [int(i) for i in lst]
lst.sort()
print(lst)
#Write a code to count the number of capital letters in the โdrivers_table.csvโ file.
with open('drivers_summary.csv') as countletter:
count = 0
text = countletter.read()
for ch... | 4.03125 | 4 | smollm | 031158014b8abca312fce0f26aefcff32c3002f8 | jgrau90/paack_tech_task | /python_task.py | 1,121 |
null | null | null | null | def ChessboardTraveling(str):
# get base and height of rectangle
coords = str.strip('()').split(')(')
start = coords[0].split()
end = coords[1].split()
b = int(end[0]) - int(start[0]) + 1
h = int(end[1]) - int(start[1]) + 1
# create matrix of 0's
matrix = [[0 for x in rang... | 3.671875 | 4 | smollm | 770bdd618f5b3cbd9604f598cf874361621cd8f6 | BarryMolina/coderbyte | /traveling.py | 1,048 |
null | null | null | null | ######################################################
#
# (C) Michael Kane 2017
#
# Student No: C14402048
# Course: DT211C
# Date: 03/010/2017
#
# Title: Caesar Cipher Decryption Alogorithm.
#
# References:
#
# Al Sweigart. (2013). Hacking The Caesar Cipher With The Brute-Force Technique. In: Hacking Secret Ciphers wi... | 4.1875 | 4 | smollm | 21fbbacf97f2b41c5010154030e8d0e8c9f0563d | MichaelKane428/PracticingPythonAndGit | /Encryption-Decryption/CaesarCipher.py | 2,049 |
null | null | null | null | from ast import literal_eval
class Produto:
"""
Classe para manipular dados dos produtos cadastrados.
Permite cadastrar, listar, alterar, pesquisar por categoria e excluir produtos.
"""
caminho_banco = "../BancoDados/produtos.txt"
def __init__(self):
"""
Mรฉtodo para criar o a... | 3.65625 | 4 | smollm | 6f1bca72a9542d10a1068b1d74b7e969aeac21c6 | GuilhermePeyflo/loja-python | /Sistema/Produto.py | 5,492 |
null | null | null | null | import csv
class GetData:
def __init__(self, file_name):
self.__data = []
self.__file_name = "./data/" + file_name
def readData(self):
f = open(self.__file_name, "r")
csv_reader = csv.reader(f)
next(csv_reader)
for line in csv_reader:
self.__dat... | 3.515625 | 4 | smollm | 626edf32edf126e1fe2a85cf1d9393aded093a18 | birna17/Lokaverkefni_Bilaleiga | /repo/GetData.py | 361 |
null | null | null | null | import os
import glob
count=0
location = input("Please Enter Location: ")
file_type=input("Please Enter Type of file")
try:
if(os.path.exists(location)):
for loc,var,file in os.walk(location):
right_type = "*" + file_type
count = count + len(glob.glob1(loc,right_type))
print(... | 3.859375 | 4 | smollm | b07f6ebd6383be946bd480636019c2e7bda04a03 | skyborn-git/Python-Random-projects | /County.py | 448 |
null | null | null | null | # dict ์์
def define_dict():
"""
์ฌ์ ์ ์ ์
"""
# ๊ธฐ๋ณธ์ ์ธ ์ฌ์ ์ ์์ฑ
dct = dict() # ๋น์ฌ์
print(dct, type(dct))
# literal ์ด์ฉํ ์์ฑ {}
dct = {"backetball":5, "baseball":9}
# ํค์ ์ ๊ทผ
print(dct["baseball"]) # baseball ํค์ ์ฐ๊ฒฐ๋ ๊ฐ์ ์ฐธ์กฐ
# print(dct["soccer"]) -> KEY ERROR, ์๋ ํค๊ฐ์ ์ ๊ทผ
# ์ ๊ฐ์ ๋ฃ์ ๊ฒฝ์ฐ ์... | 3.515625 | 4 | smollm | 8118d49bc09eb58c4b80b47a1b2a396e73e0a749 | min-yeong/Python-Basic | /basic_dict.py | 4,628 |
null | null | null | null | def order_digits(number):
number = str(number)
ordered_digits = []
for digit in number:
ordered_digits.append(digit)
ordered_digits.sort()
return ordered_digits
def check_multiples(number):
for i in range(2, 7):
if order_digits(number) != order_digits(i * number):
r... | 4 | 4 | smollm | f9470aa701c5fbf9a29e76077d0338acb08912d5 | wieczszy/Project-Euler | /problem052.py | 581 |
null | null | null | null | for x in range(1, 1000):
for y in range(1, 1000):
for z in range(1, 1000):
if x*x + y*y == z*z and x + y + z == 1000:
print(x * y * z)
break
| 3.53125 | 4 | smollm | 14f09a8235931d65fe0101796b2d3b5221e52781 | wieczszy/Project-Euler | /problem009.py | 205 |
null | null | null | null | from math import sqrt
def factors(number):
counter = 0
s_root = int(sqrt(number))
for i in range(1, s_root):
if number % i == 0:
counter += 2
if (s_root*s_root == number):
counter -= 1
return counter
number = 1
to_add = 2
while(factors(number) < 500):
number += t... | 3.609375 | 4 | smollm | c1f94701c868f067d54746ab8aa99fd5a85772db | wieczszy/Project-Euler | /problem012.py | 356 |
null | null | null | null | import math
def is_pentagonal(x):
n = (math.sqrt(24 * x + 1) + 1) / 6
return n == int(n)
i = 144
while True:
result = i * (2 * i - 1)
if is_pentagonal(result):
print(i, result)
break
else:
i += 1
| 3.71875 | 4 | smollm | 508f3a150c324ecf7d91dac89783c9fba22541cf | wieczszy/Project-Euler | /problem045.py | 244 |
null | null | null | null | # Things you should be able to do.
number_list = [-5, 6, 4, 8, 15, 16, 23, 42, 2, 7]
word_list = [ "What", "about", "the", "Spam", "sausage", "spam", "spam", "bacon", "spam", "tomato", "and", "spam"]
# Write a function that takes a list of numbers and returns a new list with only the odd numbers.
def all_odd(number_l... | 4.09375 | 4 | smollm | 0e32236efb0734572089250e54b1c5b0dbebe805 | jabrad0/Skills_Test | /Skill1_1.py | 3,277 |
null | null | null | null | userletter = str(input("Choose a letter in the English alphabet: "))
if userletter == ("a") or userletter == ("e") or userletter == ("i") or userletter == ("o") or userletter == ("u") :
print("Your letter is a vowel.")
else:
print("Your letter is a consonant.") | 4.1875 | 4 | smollm | 09a09f3b0339ee6c9b87d051ec912aa06e7b421d | MOGAAAAAAAAAA/magajiabraham | /Vowel or consonant.py | 269 |
null | null | null | null | num = int(input("Pick a number: "))
check = int(input("Pick a number to divide it by: "))
if num %check == 0:
print("Your number is divisible by", check)
else:
print("Your number is not divisible by", check) | 4.3125 | 4 | smollm | 2b2561fd1bf8f3bd957e7395f4c560b183706388 | MOGAAAAAAAAAA/magajiabraham | /Division2.py | 216 |
null | null | null | null | def two_sum(nums, target):
for i in range(len(nums)-1):
for j in range(i+1, len(nums)):
if nums[i] + nums[j] == target:
return[i, j]
# two_sumํจ์์ ์ซ์ ๋ฆฌ์คํธ์ 'ํน์ ์'๋ฅผ ์ธ์๋ก ๋๊ธฐ๋ฉด, ๋ํด์ 'ํน์ ์'๊ฐ ๋์ค๋ index๋ฅผ ๋ฐฐ์ด์ ๋ด์ returnํด ์ฃผ์ธ์.
# nums์ [4, 9, 11, 14]
# target์ 13
# nums[0] + nums[1] = 4 + 9 = 13 ์ด์ฃ ?... | 3.59375 | 4 | smollm | 4c02f8c3b5e4d77e36905413471c6e8c482f0a15 | cheesepuff90/code-kata | /day1.py | 458 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 4