text
stringlengths
5
121k
class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ subsets = [] n = len(nums) nums.sort() sum_sets = 2 ** n for i in range(sum_sets): cur_s...
import unittest from datetime import datetime from ..timeseries import TimeSeries class TimeSeriesTestCase(unittest.TestCase): def assert_has_price_history(self, price_list, series): for index, expected_price in enumerate(price_list): actual_price = series[index].value if actual_p...
import csv CONST_AUTHOR = "Shubham Sachdeva" class Product: def __init__(self, year, geo, guid, category, commodity): self.id = 0 self.year = int(year) self.geo = geo self.guid = guid self.category = category self.commodity = commodity def __str...
l1 = 'abc' list(itertools.permutations(l1)) list(itertools.permutations(l1, 2)) list(itertools.permutations('aaa')) list(itertools.permutations('aba', 2)) list(itertools.combinations([1, 2, 3, 4], 2)) list(itertools.combinations_with_replacement([1, 2, 3, 4], 2))
def sum_even_values(*args): return sum(arg for arg in args if arg % 2 == 0)
import os import numpy as np from matplotlib import pyplot def cost(theta, y, X): n = y.size prediction = np.sum(np.square(y - np.transpose(theta[1:])*X + theta[0]))/n print(prediction.shape) def gradient_descent(): return 1 def predict(): return 1 def main(): data = np.genfromtxt(os.path.join('Data', 'wine...
def fib(n): """Returns a list containing the Fibonacci series up to n.""" result = [] a, b = 0, 1 while a < n: result.append(a) a, b = b, a+b return result def func(a, L=[]): L.append(a) return L
import csv with open('./height-weight.csv', newline='') as f: reader = csv.reader(f) file_data = list(reader) file_data.pop(0) print(file_data) new_data=[] for i in range(len(file_data)): n_num = file_data[i][1] new_data.append(float(n_num)) n = len(new_data) total =0 fo...
""" Created on Tue Sep 6 09:54:49 2016 @author: ranko """ x = 25 epsilon = 0.01 step = epsilon ** 2 numGuesses = 0 ans = 0.0 while abs(ans ** 2-x) >= epsilon and ans <= x: ans += step numGuesses += 1 print("Numguesses: "+ str(numGuesses)) if abs(ans ** 2 -x) >= epsilon: print("failed to finds squuare ro...
import math def primo(x): if(x%2==0): return False for i in range(3,math.floor(math.sqrt(x))+1,2): if(x%i==0): return False return True def __main__(): x = 1 prim = 1 while(x!=10001): prim+=2 if(primo(prim)): x+=1 print(prim) __main__()
def factorial(x): if(x<=1): return 1 else: return x*factorial(x-1) def __main__(): tam = 20 routes = factorial(2*tam)/(factorial(tam)**2) print(routes) __main__()
num = float(input("Enter a number: ")) if num >0: print("positive") elif num <0 : print("negative") else: print(" number is zero") num=int(input("enter the number:\n")) if (num %2==0): print("The number is even") else: print("the number is odd") ...
''' This script is designed to pull many objects in JSON from an api. It then formats it into a csv file. This was done to research the every screensaver that roku had to offer. ''' import requests from bs4 import BeautifulSoup as bs import json import pandas as pd import csv new_file = 'roku_extracted_data.csv' ...
''' In order to run any reddit scraper using the PRAW API, you have to register yourself with reddit. To avoid reeditting each script with the user's API keys, this script inputs them all into a central CSV which will later be referred to in each script. ''' import csv print('Follow the instructions below to input the...
''' In addition to the reguilar reddit scraper, the same client wanted to scrape all of reddit for specific search terms. This was not difficult to implement as the subreddit for all of reddit is simply "all". ''' import praw import pandas as pd import datetime name = 'reddit_login_info.csv' info_csv = pd.read_csv(n...
name = input("Please enter a name: ") name = name.lower() total = 0 for each in name: val = ord(each)-96 total = total + val print("The numeric value of the name is:", total)
def main(): fname = input("Please enter the filename: ") infile = open(fname, "r") data = infile.read() stripnl = data.replace("\n", " ") words = stripnl.split(" ") count = len(words) print("The number of words in the file is: ", count) main()
import unittest def is_prime(num): """ Iterate from 2 up to the (number-1). Assume the number is prime, and work through all lower numbers. If the number is divisible by ANY of the lower numbers, then it's not prime """ prime_status = True if num == 1: prime_status = Fal...
import time import datetime def sequential_search(a_list,item): pos = 0 found = False while pos < len(a_list) and not found: if a_list[pos] == item: found = True else: pos = pos + 1 return found def sequential_search1(a_list,item): for num in a_list: ...
prompt = "\nWelcome to the movies; What is your age?" prompt += "\nEnter quit when finished." while True: age = input(prompt) if age == "quit": break age = int(age) if age < 3: print("You're ticket is free.") elif age >= 3 and age <= 12: print("The ticket i...
import json def read_number(): """Get stored number if available""" try: filename = "favorite_num.json" with open(filename) as f_obj: number = json.load(f_obj) print(number) except FileNotFoundError: print("This file was not found..") read_number()
my_list = ["Lauren", "David", "David"] print(my_list[3])
class User(): """Making a brief user profile""" def __init__(self, first_name, last_name, gender, age, hometown): self.first_name = first_name self.last_name = last_name self.gender = gender self.age = age self.hometown = hometown self.login_attempts = 0 d...
car = input("What type of car would you like?") print("Let me see if I can find you a " + car.title() + ".")
import json def get_stored_username(): """Get stored username if available.""" filename = "username.json" try: with open(filename) as f_obj: username = json.load(f_obj) except FileNotFoundError: return None else: return username def get_new_username(): ...
def make_album(artist, title, tracks=0): album = { "artist": artist.title(), "title": title.title() } if tracks: album["tracks"] = tracks return album while True: artist = input("Enter artists name; Press 'q' to quit ") if artist == "q": break title = in...
cat = "pregnant" print("Is cat == 'pregnant'? I predict true.") print(cat == "pregnant") print("\nIs cat == 'not pregnant'? I predict false.") print(cat == "not pregnant") color = "purple" print("\n Is color == 'purple', I predict true:") print(color == 'purple') print("\n Does color = 'blue', I predict false:") ...
favorite_places = { "david": ["netherlands", "romania", "germany"], "lauren": ["bahamas", "chicago"], "bob": ["pennsylvania"] } for person, places in favorite_places.items(): print(person.title() + " 's favorite places are: ") for place in places: print("\t-" + place.title())
sandwich_orders = ["turkey", "roast beef", "chicken", "BLT", "ham"] finished_sandwiches = [] while sandwich_orders: making_sandwich = sandwich_orders.pop() print("I made your " + making_sandwich + " sandwich.") finished_sandwiches.append(making_sandwich) print("\n Here are the list of sandwiches fini...
class User(): """Making a brief user profile""" def __init__(self, first_name, last_name, gender, age, hometown): self.first_name = first_name.title() self.last_name = last_name.title() self.gender = gender.title() self.age = age self.hometown = hometown.title() d...
famous_person = "Vince Lombardi" message = """ "The difference between a successful person and others is not a lack of strength, not a lack of knowledge, but rather a lack of will." """ famous_quote = famous_person + " once said," + message print(famous_quote)
import sqlite3 username = 'admin' password = 'admin' PATH = r'C:\Users\User\Desktop\AnjalSaps\projects\pythondjangoprojects\pythontkinterfinalproject\tkinterr\lib_mngmt' def connect(): conn = sqlite3.connect(PATH) return conn def create_table_book(): conn=connect() c=conn.cursor() c.execute('''crea...
import turtle wn = turtle.Screen() wn.bgcolor("lightgreen") tess = turtle.Turtle() tess.color("hotpink") tess.pensize(5) alex = turtle.Turtle() tess.forward(80) tess.left(120) tess.forward(80) tess.left(120) tess.forward(80) tess.left(120) tess.right(180) tess.forward(80) alex.forward(50) alex.left(90) alex....
class Bubble(): """Class for bubble objects""" def __init__(self, id, x, y, x2, y2, value): """each bubble object has these values associated with it""" self.x = x self.y = y self.x2 = x2 self.y2 = y2 self.id = id self.value = value def getX(self): ...
import threading import time event = threading.Event() def chihuoguo(name): print('%s 已经启动' % threading.currentThread().getName()) print('小伙伴 %s 已经进入就餐状态!'%name) time.sleep(1) event.wait() print('%s 收到通知了.' % threading.currentThread().getName()) print('小伙伴 %s 开始吃咯!'%n...
import decision_tree import random """ Random forest Machine Learning Model by Rishi Pandey. Generates a Random forest Machine Learning Model. Model is trained based off of data loaded as CSV. """ """ Object for a Random Forest ML Model. Contains a forest of decision trees, accuracy of model, and differences between a...
import numpy as np np.random.seed(0) def createTargetData(digit_list): """ generate len(digit_list) vector, whose i th element is the corresponding parity upto the ith element of the input.""" sum_ = 0 parity_list = [] sum_ = digit_list[0] if sum_ % 2 == 0: parity_list.append(0) ...
print (max('flyiNg'))
import os import sqlite3 as sql class Database: def __init__(self,p): if not os.path.exists(os.path.dirname(p)): os.makedirs(os.path.dirname(p)) self.conn = sql.connect(p) self.cursor = self.conn.cursor() self.cursor.execute("CREATE TABLE IF NOT EXISTS 'users' (...
""" This module contains useful functions used globally. """ import numpy as np import pandas as pd from typing import Tuple def prepare_data(data: pd.DataFrame) -> Tuple[float, float]: """Normalize data, so both axis have a similar scale.""" max_km = data["km"].max() max_price = data["price"].max() data["km"] =...
""" Base64 Script """ import inspect def str_to_bin(text): """ str -> binary """ bin_text = "" for i in text: i_bin = format(ord(i), "b") bin_text += (i_bin if len(i_bin) == 8 else ("0" * (8 - len(i_bin))) + i_bin) return bin_text def bin_to_str(bin_text): """ binary -> str """ text = chr(int(bin_text, 2...
import sqlite3 import pandas as pd from pandas.io import sql def read_csv(csv_file): """ :param csv_file: the path of csv file :return: a dataframe out of the csv file """ return pd.read_csv(csv_file) def write_in_sqlite(data_frame, database_file, table_name): """ :param data_frame: the ...
import pandas as pd def print_data_frame(data_frame, print_columns=True, print_rows=True): if print_columns: print(",".join(data_frame.columns)) if print_rows: for index, row in data_frame.iterrows(): print(",".join([str(row[column]) for column in data_frame])) def data_cleaning(...
import random import heapq class PriorityQueue: def __init__(self): self.elements = [] def empty(self): return len(self.elements) == 0 def put(self, item, priority): heapq.heappush(self.elements, (priority, item)) def get(self): return heapq.heappop(self.elements)[1]...
import random from career import ManagerCareer from strategy import Strategy class Manager(object): """The baseball-manager layer of a person's being.""" def __init__(self, person, team): """Initialize a Manager object.""" self.person = person person.manager = self self.care...
import random class Event(object): """A superclass that all event subclasses inherit from.""" def __init__(self, cosmos): """Initialize an Event object.""" self.year = cosmos.year if self.year < cosmos.config.year_worldgen_begins: self.month, self.day, self.ordinal_date ...
import sys import math light_x, light_y, initial_tx, initial_ty = [int(i) for i in input().split()] while True: remaining_turns = int(input()) moveWE = light_x - initial_tx moveSN = initial_ty - light_y initial_tx += 1 if moveSN == 0 or moveWE > 0 else - 1 if moveWE < 0 else 0 init...
def add(x, y): return x + y print(add(1, 2)) a = lambda x,y : x+y print(a(1, 2)) alist = list(filter(lambda x:True if x % 3 == 0 else False, range(100))) print(alist) adict = {1:'a', 2:'b', 3:'c'} for a in adict.items(): print(a[1]) alam = lambda item:item[1] for a in adict.items(): print(alam(a))
from __future__ import print_function import sys class PE_007: def __init__(self, max_size=100000): self.primes = [] self.collect_primes(max_size) def find_prime(self, index): if len(self.primes) == index: collect_primes(index*2) if index < 1 or index >= len(self.p...
import sys from enum import Enum class Acid(Enum): NON_METAL = 'non-metal acid' POLYATOMIC = 'polyatomic acid' NOT_ACID = 'not an acid' def name_acid(text: str) -> Acid: hydro = text.startswith('hydro') poly = text.endswith('ic') if hydro and poly: return Acid.NON_METAL elif pol...
from __future__ import print_function import sys def staircase(height): lines = [] for n in range(height): string = '' for i in range(height): string += '#' if i >= n else ' ' lines.append(string) return reversed(lines) def main(): T = int(input()) for line in s...
print("hello world\nhello world \nhello world") print("Day 1 - String Manipultion") print("Concactenation is done with "+"sign,") print('eg = print("hello" + "world")') print("New line will be created by using a backslash and n") print("hello"+" "+ input("wht is your name?\n")) print(len(input(" what is your name?"))) ...
from decimal import * constant_one = 1 def discrete_calculate(): principal = float(input("Enter the principal amount: $")) time = int(input("Enter the time in years: ")) rate = float(input("Enter the interest rate in percentage form (Ex. 5.2): ")) compound = int (input("How many times a year is ...
from arrayFill import * canvas = create2dArray(int(input("Specify number of Columns: ")), int(input("Specify number of Rows: "))) print2dArray(canvas) canvas = diag2dArray(canvas) print2dArray(canvas) fillBucket(canvas,int(input("Specify Y coord: ")),int(input("Specify X coord: ")),0,2) print2dArray(canvas)
class Solution(object): def addTwoNumbers(self, l1, l2): carry = 0 result = ListNode(0) ptr = result p1 = l1 p2 = l2 while p1 or p2: v1 = 0 v2 = 0 if p1: v1 = p1.val p1 = p1.next i...
class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ def twoSum(nums, l, r, target): sums = [] while l < r: if nums[l] + nums[r] == target: sums.append([nums[l], ...
class Solution(object): def __init__(self): self.cache = {} def isScramble(self, s1, s2): """ :type s1: str :type s2: str :rtype: bool """ """ for a string AB, it's scramble string is BA """ if len(s1) != len(s2...
def gcd(a, b): if (a == 0): return b return gcd(b % a, a) def phi(n): result = 1 for i in range(2, n): if (gcd(i, n) == 1): result+=1 return result def main(): for n in range(1, 11): print("phi(",n,") = ",phi(n), sep = "") if __name__ == "__main__": ...
def circle_area(r): pi = 3.142 area_of_circle = pi * r * r return area_of_circle if __name__ == '__main__': try: r = int(input("Enter the radius of the circle: ")) area = circle_area(r) print(area) except ValueError: print(" You need to enter a value for radius"...
from random import randint count = 1 def ten_or_less_message(count): if count == 10: return "Aha! You know the secret!" random_message = randint(1, 2) if random_message == 1: return "You got lucky!" if random_message == 2: return "You know the secret" def greater_than...
def area (a,b,c): s = 0.5*(a + b + c) output = (s*((s-a)*(s-b)*(s-c))) ** 0.5 print(str(output)) area(3, 4, 5)
import numpy as np def smooth_convolve(x, window_len=11, window='hanning'): """smooth the data using a window with requested size. This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in ...
import nltk from nltk.tokenize import TweetTokenizer s = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit." tknzr = TweetTokenizer() tokens = tknzr.tokenize(s) tokens = [str.lower() for str in tokens] print(tokens[1]) print(tokens)
''' Single File Programming Question Your little brother has a math assignment to find whether the given number is a power of 2. If it is a power of 2 then he has to find the sum of the digits. If it is not a power of 2, then he has to find the next number which is a power of 2. He asks for your help to validate his w...
''' Write a program to calculate and return the sum of distances between the adjacent numbers in an array of positive integers Note: You are expected to write code in the find TotalDistance function only which will receive the first parameter as the number of items in the array and second parameter as the array itsel...
def numdiv(input1): First = [] Second = [] input2 = list(map(int, input("Enter the Elements: ").strip().split(",")))[:input1] input3 = int(input("Enter the number: ")) First = input2[:input3] Second = input2[input3:] Combine = Second + First print(Combine) input1 = int(input("Ente...
def FindMostFrequentVowel(str): a=0 e=0 x=0 o=0 u=0 for i in range(len(str)): if str[i] == "a" or str[i] == "A": a = a+1 elif str[i] == "e" or str[i] == "E": e= e+1 elif str[i] == "i" or str[i] == "I": x= x+1 elif str[i] ==...
def OddEven(input1): a = 0 b = 0 for i in range(len(input1)): if i % 2 == 0: a = a + int(input1[i]) else: b = b + int(input1[i]) print(str((b - a))[1:]) input1 = input("Enter the number: ") OddEven(input1)
''' Write a function to find all the words in a string which are palindrome Note: A string is said to be a palindrome if the reverse of the string is the same as string. For example, "abba" is a palindrome, but "abbe" is not a palindrome. Input Specification: input1: string input2: Length of the String Output Spe...
cat=True dog=False print(cat) type(cat) print(cities) first_alb = (cities[0] == "Albuquerque") second_alb = (cities[1] == "Albuquerque") last_element_index = len(cities) - 1 first_last = (cities[0] == cities[last_element_index]) print(crime_rates) first_500=crime_rates[0]>500 first_749=crime_rates[0]>=749 leng=...
command = "" carStatus = False while True: command = input("> ").lower() if command == "start": if carStatus: print("Car is already started") else: carStatus = True print("Car started...") elif command == "stop": if carStatus: print("Ca...
a = input('enter the string ') def word_count(str): counts = dict() words = str.split() for word in words: if word in counts: counts[word] += 1 else: counts[word] = 1 return counts print(word_count(a))
import random from itertools import permutations a = input('sentence ') b = list(permutations(a)) i = 0 while i<5: print(''.join(b[random.randint(0, len(b))])) i+=1
import os; path = os.getcwd() os.chdir("Result") file_name_list = os.listdir() for old_file_name in file_name_list: if "3-1" in old_file_name: os.remove(old_file_name) os.chdir(path)
''' Given a URL address, this program returns the broken links in the page. This works faster than the solution in the book by making asynchronous requests with grequests (https://github.com/spyoungtech/grequests) ''' import grequests from urllib.request import urlopen from bs4 import BeautifulSoup page_url = input...
x=int(input("enter any number")) y=int(input("enter any number")) t=(1,2,"a",1.2,9,x,y) print(t) print(len(t))
import tkinter from tkinter import * import sys dic={"rahul":95943053548,"mohit":84593745722,"malay":94524592345,"rajan":87654322678,"nihal":7564565503,"rahul":856453545343,"satyam":8435340034554,"rajan":9845384754,"gurdeep":94954378758,"aman":83458439877,"nikhil":6345666764,"mukesh":85422422455,"deepak":84735...
class expenditure: def __init__(self,expenditure,savings): self.expenditure=expenditure self.savings=savings def total_salary(self): print("your expenditure is ",self.expenditure) print("your saving is",self.savings) salary=self.expenditure+self.savings print("your salary is",salary) a=expenditur...
import threading from threading import Thread import time def display(): print("child thread:",threading.current_thread().getName()) bt=time.time() time.sleep(3) print("child thread:",threading.current_thread()) et=time.time() print("total time taken:",et-bt) t=Thread(target=display) t.start()
import threading from threading import Thread import time class factorial(Thread): def run(self): n=int(input("enter any number:")) fact=1 for i in range(1,n+1): fact = fact * i print("factorial:",fact) t=factorial() t.start()
def rec(x,y): if y<=10: t=x*y print(t) y+=1 rec(x,y) rec(12,1)
l=[1,'a',2,3,3.2,5,8.2] li=[] lf=[] ls=[] for x in l: if type(x)==int: li.append(x) elif type(x)==float: lf.append(x) elif type(x)==str: ls.append(x) print(li) print(lf) print(ls)
def perfect(num): sum=0 for x in range(1,num): if num%x==0: sum=sum+x if sum==num: print(num,":is a perfect number") for x in range(1,1001): perfect(x)
"""Assume you have access to a function toss_biased() which returns 0 or 1 with a probability that's not 50-50 (but also not 0-100 or 100-0). You do not know the bias of the coin. Write a function to simulate an unbiased coin toss. """ import random unknown_ratio_heads = random.randint(1,100) unknown_rati...
"""A number is considered perfect if its digits sum up to exactly 10. Given a positive integer n, return the n-th perfect number. For example, given 1, you should return 19. Given 2, you should return 28.""" def find_nth_perfnum(n): temporary_sum = 0 for digit in str(n): temporary_sum += int(digit) return...
import random from math import * from echo import f f('基础方法') n = random.randrange(1, 5) print(n) n = random.random() print(n) print(floor(10 * n)) print(ceil(10 * n)) print(round(10 * n)) n = random.randint(1, 9) print(n) f('元祖tuple') arr = (1, 4, 2, 7) print(sorted(arr, reverse=True)) print(arr[1]) f('...
'a test module' __author__ ='Michael Yan' import sys def test(): args=sys.argv if len(args)==1: print('Hello world') elif len(args)==2: print('Hello ,%s'%args[1]) else: print("tooo many arguments") if __name__=='__main__': test() class Student(object): def __init...
def connectedWith(index): for n in range(0,len(pipes[index])): if pipes[index][n] not in groups[-1]: groups[-1].append(pipes[index][n]) connectedWith(pipes[index][n]) puzzle = open('day12Input.txt', 'r') pipes = [] for line in puzzle: line = line.replace(' <-> ', ' ').replace(', ', ' ').replace('\n', '') ...
from copy import deepcopy puzzle = [4, 10, 4, 1, 8, 4, 9, 14, 5, 1, 14, 15, 0, 15, 3, 5]; previous = [puzzle] seenBefore = False count = 0 while not seenBefore: count = count + 1; p = deepcopy(puzzle) maxValue = max(p) maxIndex = p.index(maxValue) p[maxIndex] = 0 for i in range(1,maxValue+1): index = (maxInde...
from iterator.book import Book, BookShelf def startMain(): bookShelf = BookShelf() bookShelf.append(Book(name="Aroun d the World in 80 days")) bookShelf.append(Book(name="Bible")) bookShelf.append(Book(name="Cinderella")) bookShelf.append(Book(name="Daddy-Long-Legs")) for book in bookShelf: ...
class math_operations(object): class_attribute_example="Something" def __init__(self,a,b): self.a=a self.b=b def addition(self): sumof = self.a + self.b return sumof def subtraction(self): subof = self.a - self.b return subof ...
estado = dict() brasil = list() for c in range(0, 3): estado['uf'] = input('Unidade Federativa: ') estado['sigla'] = input('Sigla do estado: ') brasil.append(estado.copy()) for e in brasil: for v in e.values(): print(v, end=' ') print()
import socket UDP_IP_ADDRESS = "127.0.0.1" UDP_PORT_NO = 1234 serverSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) serverSock.bind((UDP_IP_ADDRESS, UDP_PORT_NO)) print('socket listensing ... ') while True: data, addr = serverSock.recvfrom(1024) print ("Message: ", data.decode("utf-8"),"Adrees is...
data_valid = False while data_valid == False: grade1 = input("Enter the first grade: ") try: grade1 = float(grade1) except: print("Invalid input. Only numbers are accepted. Decimals should be separated with a dot.") continue if grade1 <0 or grade1 > 10: print("...
my_age = 26 your_age = int( input("Please type your age: ") ) if(my_age > your_age): print("I'm older than you") elif(my_age == your_age): print("We are the same age") else: print("You're older than me")
list1 = [1, 2, 3, 4, 5] list2 = [10, 11] listadd = list1 + list2 print(listadd) listmulti = list2 * 3 print(listmulti)
def calcsum(n): def add(a,b): return a+b sum = 0 for i in range(n+1): sum = add(sum, i) return sum print('~10 =', calcsum(10))
nums = [0,1,2,3,4,5,6,7,8,9] nums[2:5] = [20,30,40] print(nums) nums[6:] = [90,91] print(nums)
from tkinter import * import tkinter.messagebox import tkinter.simpledialog main = Tk() def btnclick(): name = tkinter.simpledialog.askstring("질문", "이름을 입력하시오") age = tkinter.simpledialog.askinteger("질문", "나이를 입력하시오") if name and age: tkinter.messagebox.showwarning("환영", str(age) + "세 " ...
from turtle import Turtle class Paddle(Turtle): def __init__(self, position): super().__init__() self.shape("square") self.penup() self.setheading(90) self.color("white") self.shapesize(stretch_len=5) self.setposition(position) def move_up(self): ...