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 |
null | null | null | null | nota1 = int( input("Digite a nota 1: "))
nota2 = int( input("Digite a nota 2: "))
media = (nota1 + nota2) / 2
if media >= 6:
print("VOCE FOI APROVADO: " + "MEDIA: ", media)
elif media < 4:
print("VOCE ESTA EM REPROVADO:" + "MEDIA: ", media)
else:
print("VOCE ESTA EM RECUPERACAO: " + "MEDIA: ", m... | 4.03125 | 4 | smollm | 4617259b96130bc9ddca55f020042a5776b1a291 | rgerk/PythonFiap | /variavel_numero.py | 330 |
null | null | null | null |
# coding: utf-8
# # Presentation outline
# - Purpose and use of Pandas
# - Pandas data structures
# - Loading data
# - Simple data analysis and exploration
# - Selecting and indexing
# - Visualizing
# - Using APIs - examples
# - Requests
# - Scrapy
# # Purpose of Pandas
# - Large data sets
# - Clean up data... | 3.515625 | 4 | smollm | 8373ba13e44bd2758e3894565bb897f6d55e4c7b | Caram44/Presentations | /ECN_Pandas_api_March_2017.py | 8,330 |
null | null | null | null | import numpy as np
import matplotlib.pyplot as plt
def sigmoid(z):
return 1 / (1 + np.exp(-z))
arr13 = [-1, 0, 1]
tst = sigmoid(np.array(arr13))
print("arr13")
print(arr13)
print("after sigmoid")
print(tst)
matrix33 = np.random.randn(3, 3)
print("matrix33")
print(matrix33)
print("after sigmoid")
tst = sigmoid(ma... | 3.625 | 4 | smollm | a96e35fa9bb331a9e5a5fd46f6f24936d3679f5f | Archanciel/Neural-Networks-Demystified | /sigmoidExplore.py | 339 |
null | null | null | null | # Tupla --> Imutavel
#num = (2, 5, 9, 1)
# num[2] = 3 --> ERRO
#
# Lista --> Aceita mudanças de valores
num = [2, 5, 9, 1]
num[2] = 3
print(num)
# num[4] = 7 #ERRO pois não posso adicionar elementos dessa forma
num.append(7) #Adicionar elemento 7 a lista
num.sort() #Organiza por ordem
num.sort(reverse=True) #Organiza ... | 4.25 | 4 | smollm | 0dd42d2cf7a3eb76f5ae2302801669ee3783a930 | Guilherme-Galli77/Curso-Python-Mundo-3 | /Teoria-e-Testes/Aula017 - Listas (Parte 1).py | 1,500 |
null | null | null | null | # Exercício Python 112: Dentro do pacote utilidadesCeV que criamos no desafio 111, temos um módulo chamado dado. Crie
# uma função chamada leiaDinheiro() que seja capaz de funcionar como a função imputa(), mas com uma validação de
# dados para aceitar apenas valores que seja monetários.
from Ex112.utilidades import *
... | 4.0625 | 4 | smollm | e37abdb423ae736341384bf36514131892cf8e8b | Guilherme-Galli77/Curso-Python-Mundo-3 | /Exercicios/Ex112/main.py | 551 |
null | null | null | null | #Exercício Python 076: Crie um programa que tenha uma tupla única com nomes de produtos
# e seus respectivos preços, na sequência. No final, mostre uma listagem de preços,
# organizando os dados em forma tabular.
print("="*40)
print(" CARDÀPIO ")
listagem = ("Hamburguer", 15.75,
"Ba... | 4.125 | 4 | smollm | 39961e9d3a35eabad3f4077d8c9d16f5b6b2d529 | Guilherme-Galli77/Curso-Python-Mundo-3 | /Exercicios/Ex076 - Lista de Preços com Tupla.py | 738 |
null | null | null | null | #Exercício Python 082: Crie um programa que vai ler vários números e colocar em uma lista.
# Depois disso, crie duas listas extras que vão conter apenas os valores pares
# e os valores ímpares digitados, respectivamente. Ao final, mostre o conteúdo das três listas geradas.
lista = list()
par = list()
impar = list()
w... | 4.0625 | 4 | smollm | 75b87ffba71ae89ac6bb1d6de6d1ca438e672c3e | Guilherme-Galli77/Curso-Python-Mundo-3 | /Exercicios/Ex082 - Dividindo valores em várias listas.py | 812 |
null | null | null | null | teste = list()
teste.append("Guilherme")
teste.append("20")
galera = list()
galera.append(teste[:])
teste[0] = "Maria"
teste[1] = "34"
galera.append(teste[:])
print(galera)
print("="*50)
pessoal = [["João", 19], ["Ana", 33], ["Joaquim", 13], ["Maria", 45]]
print(pessoal[0]) #João,19
print(pessoal[0][0]) #João
print(p... | 4 | 4 | smollm | 70a75059e7012f345dc317d383c863200e1ca161 | Guilherme-Galli77/Curso-Python-Mundo-3 | /Teoria-e-Testes/Aula018 - Listas (Parte 2).py | 1,173 |
null | null | null | null | from uteis import *
num = int(input("Digite um valor: "))
fat = fatorial(num)
dob = dobro(num)
tri = triplo(num)
print(f"O fatorial de {num} é {fat}")
print(f"O dobro de {num} é {dob}")
print(f"O triplo de {num} é {tri}") | 3.890625 | 4 | smollm | 46d8ee73a75c4b37dde37c260088beb2c55a13a7 | Guilherme-Galli77/Curso-Python-Mundo-3 | /Teoria-e-Testes/Aula022 - Módulos e Pacotes/numeros.py | 224 |
null | null | null | null | #!/usr/bin/env python
#makefaq -- a script for generating the frequently asked questions page
import os
import glob
faqfile = 'faq.html'
if os.path.isfile(faqfile): os.remove(faqfile)
#build header string
header_str = """
<!doctype html>
<head>
<meta name="description" content="Resources for git and github">
... | 3.53125 | 4 | smollm | 85592782dd15dc0c33803a7fdd74a2fbdadfc105 | saltastro/saao_git_tutorial | /makefaq.py | 908 |
null | null | null | null | # First we'll import the os module
# This will allow us to create file paths across operating systems
import os
# Module for reading CSV files
import csv
csvpath = os.path.join('.', 'Resources', 'budget_data.csv')
output_path = os.path.join('.', 'Analysis', 'output.txt')
# Creating Variables
TotalMonths = 0
TotalPr... | 3.796875 | 4 | smollm | 61f6cda51890a7fd2882ad1e0ec6d507b5f26050 | jlvp07/python-challenge-JLVP | /PyBank/main.py | 2,292 |
null | null | null | null | class Calc:
def __init__(self,intDataA,intDataB,intWork):
self.intDataA = intDataA
self.intDataB = intDataB
self.intWork = intWork
# print(self.intWork,self.intDataA,intDataB)
def main(self):
if self.intWork == 1:
result = self.intDataA + self.intDataB
... | 3.625 | 4 | smollm | 2bb4ef905346eec46b326d8a6dadf604bc46835b | rout666/workdir | /Calc/calc.py | 661 |
null | null | null | null | import datetime
from dateutil import parser as date_parser
import pytz
from .timezones import common_timezones
from .parser import free_text
from .parser import _from
def convert(timestamp, to_tz="utc", from_tz="utc", naive=True):
"""Convert a timestamp from one timezone to another.
Args:
timestamp... | 3.59375 | 4 | smollm | fb9697f3cd5aafd346ab1ee6f4c6357f55c67cb5 | sbuss/wtftz | /wtftz/converter.py | 4,145 |
null | null | null | null | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from sklearn.cluster import KMeans
import preprocessing as pp
import pickle
def cluster(dataframe, n_cluster):
"""
The function performes kmeans clustering on the input dataframe.
It also plots graphs to show ... | 3.984375 | 4 | smollm | 12ea2341e23dfc05ca56bc951d6935d757452579 | hamk-automation/OLK_for_maintenance | /clustering.py | 1,305 |
null | null | null | null | # -*- coding: utf-8 -*-
from random import random,randint
import math
#根据酒的等级和储藏的年代来决定酒的价格
def wineprice(rating,age):
peak_age=rating-50
price=rating/2
if age>peak_age:
#经过“峰值年”,后继5年其品质将会变差
price=price*(5-(age-peak_age))
else:
#价格在接近“峰值年”时会增加到原值的5倍
price=price*(5*((age... | 3.71875 | 4 | smollm | 99318fd42b760e7ec5767f6033a4ea178e8da2a5 | Windriver/codelab | /programming-collective-intelligence/pricemodel/numpredict.py | 3,372 |
null | null | null | null | #Q1
'''
def is_odd(a):
if a%2 == 1:
print('홀수')
else:
print('짝수')
'''
#Q2
'''
def avg_many(*a):
return sum(a)/len(a)
'''
#Q3
'''
input1 = input("첫번째 숫자를 입력하세요:")
input2 = input("두번째 숫자를 입력하세요:")
total = int(input1) + int(input2)
print("두 수의 합은 %s 입니다" % total)
'''
#Q4
'''
3. print("you",... | 3.59375 | 4 | smollm | 56ff7a66d16c0406ca9f013d5eb788416a318299 | hms1707/source | /0714연습문제.py | 865 |
null | null | null | null | import re
import itertools
def is_valid(passphrase, check_anagrams=False):
passphrase = passphrase.strip()
passphrases = {}
for word in re.findall('\\w+', passphrase):
if passphrases.get(word):
return False
passphrases[word] = 1
if check_anagrams:
for anagra... | 4.03125 | 4 | smollm | e846b8e3641727367b5c4e1c40e244de550ef54e | natemago/adventofcode2017 | /day4_high_entropy_passphrases/solution.py | 980 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.