text
stringlengths
5
121k
import tkinter import kiloToMiles ''' Converts kilometers to miles Displays result in Label ''' class KiloConverterGUI: def __init__(self): self.__kilo_val = kiloToMiles.KiloToMiles() self.__main_window = tkinter.Tk() self.__top_frame = tkinter.Frame(...
import random import math import turtle def main(): tyr = turtle.Turtle() wn = turtle.Screen() wn.setworldcoordinates(-2,-2,2,2) tyr.hideturtle() tyr.penup() tyr.goto(-1,-1) tyr.pendown() tyr.goto(-1,1) tyr.goto(1,1) tyr.goto(1,-1) tyr.goto(-1,-1) tyr.goto(-1,0) ...
def main(): print("This program will divide two numbers of your choosing for as long as you like\n") divisorStr = input("Input a divisor: ") while divisorStr: dividendStr = input("Input a dividend: ") try: divisor = int(divisorStr) dividend = int(dividendStr) print (dividend ...
''' Stores value in kilometers Retrieves value in kilometers or miles Displays value in kilometers and miles ''' class KiloToMiles: def __init__(self, kilo = 0.0): self.__kilo = float(kilo) self.__KILO_TO_MILES = 0.6214 def get_kilo(self): return self.__kilo def to_mi...
import tkinter import tkinter.messagebox ''' Demonstrates Tk class destroy() method when Quit button clicked as well as info dialog box ''' class MyGUI: def __init__(self): self.__main_window = tkinter.Tk() self.__my_button = tkinter.Button(self.__main_window, \ ...
''' You are a clerk. There are 4 kinds of coins at the counter, which are 500,100,50,10. Find the minimum number of coins to be exchanged , assuming the guest is paying N. However, N is always a multiple of 10. ''' n = 1260 count = 0 array = [500,100,50,10] for coin in array: count += n // coin n %= coin pr...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def insertafternode(self, val): temp = self.head while(temp.data != val): temp = temp.next ne=input() tm...
def sort(in_string): in_string = list(in_string) alphabetized = False while not alphabetized: alphabetized = True for i in range(len(in_string)): if i == 0: continue if ord(in_string[i]) < ord(in_string[i - 1]): ...
num=int(input("eneter a number")) sum=0 temp=num while(temp>0): digit=temp%10 sum=sum+digit**3 temp=temp//10 if (num==sum): print(("armstrong number")) else: print("not")
import os shopping_list = [] def clear_screen(): os.system("cls" if os.name == "nt" else "clear") def show_help(): clear_screen() print("What should we pick up at the store?") print(""" Enter 'DONE' to stop adding items. Enter 'HELP' for this help. Enter 'SHOW' to see your current list. Ente...
import random import os play = True while play == True: list_one_size = random.randint(10,20) list_two_size = random.randint(10,20) list_one = [] list_two = [] common_list = [] x = range(1,list_one_size) for elem in x: num = random.randint(1,20) list_one.append(num) y = range(1,list_two_size) for ...
import re def convert_str_to_list(text, seperator=' '): text_list = text.split(seperator) return list(filter(None, text_list)) def convert_str_to_num_list(text, seperator=' '): text_list = re.sub(r'\D', seperator, text).split(seperator) return list(filter(None, text_list))
''' Propagate from bottom if left is found and right is found (p,q). We have to traverse post-orderly to make sure we don't miss anything. This works because if they are not found in the left and right subtree respectively, it means the common ancestor not this one and is in one of the subtree. Also, only one of the...
print ("hello world") a="hema" print ("hai",a) a=int(input("enter a number")) b=int(input("enter another number")) c=a+b print("Addition of two numbers:",c) import matplotlib.pyplot as plt var=['a','b','c'] var1=[5.5,6.2,6.3] plt.plot(var,var1) plt.title("Height of students in a class") plt.xlabel(...
from random import randint from game1 import number_game def show_menu(): print("\n===========================================") print("| Welcome |") print("| Do you want to play a game? |") print("| 1. Enter the number game |") print("| ...
import fire import json from util import Cashflow from util import InvestmentProject class Main(object): @staticmethod def describe_investment(filepath, hurdle_rate=None): investment_project = InvestmentProject.from_csv(filepath=filepath, hurdle_rate=hurdle_rate) description = investmen...
class Dog: def __init__(self, name, age, weight, length=5): """initialize the profile/attribute """ self.name = name self.age = age self.weight = weight self.length = length def sit(self): print(f"one {self.age} years old and {self.length}m long dog named {self.n...
import cv2 A=cv2.imread("lena.jpg") demi_gauche = A[:,0:A.shape[1]//2] demi_droite = A[:,A.shape[1]//2:] demi_dessus = A[:A.shape[0]//2,:] demi_dessous = A[A.shape[0]//2:,:] gray = cv2.cvtColor(A, cv2.COLOR_BGR2GRAY) print(A) print(A.shape) print(gray.shape) cv2.imshow("Gray",gray) cv2.imshow(...
gradosC = int(input("Digites los Grados Centigrados: ")) formula = gradosC * (9/5) Fahrenheit = formula + 32 print(f"{gradosC} Centigrados son {Fahrenheit} Fahrenheit ")
segundos = int(input("Digite los Segundos: ")) lustro = (segundos) * 0.1577 print(f"{segundos} segundos son {lustro} Lustros")
from csv import reader def main(): infile = open("grades.csv", "r") csvReader = reader(infile) gradeData = [] for row in csvReader: gradeData.append(row) print("{0:12} {1:15} {2:18} {3:5} {4:5} {5:5} {6:15} {7}".format("ID", "LAST", "FIRST", "P1", "P2", ...
""" Created on Tue Jul 10 14:13:04 2018 @author: user """ import mod a = mod.hello() print(a) def mydef(name): print('yo' , name) def mydef2(name): print('hi'+ name) def mydef3(name = 'noname'): print('hi', name) def redef(x): count = x * 10 return count mydef('ho') mydef2('hola') mydef(6) ...
class Player(): def __init__(self, name, hand): self.name = name self.hand = hand def play_card(self): drawn_card = self.hand.remove_card() print(f'{self.name} has placed {drawn_card}. ') print() return drawn_card def war(self): if len(se...
h = open('test.txt', 'r') content = h.readlines() a = 0 for line in content: for i in line: if i.isdigit() == True: a += int(i) print("The sum is:", a)
''' defining function for importing. allow progs to import the def ''' def squareNumber(num): answer = num * num return answer def multiply(num1, num2): answer = num1 * num2 return answer
''' from file - PyFunctions.py def squareNumber(num): answer = num * num return answer def multiply(num1, num2): answer = num1 * num2 return answer ''' import PyFunctions num1 = int(input("Please enter the number you wish to multiply: ")) num2 = int(input("Please enter the valu...
import time import sys def wait(): time.sleep(1) def CloseProg(txt): txt.lower() if(txt!='y'): sys.exit() def UsersDecision(): userChoice = str(input("If you wish to use again, press \"Y\": ")) return userChoice def main(): while(True): examMark = int(input("Plea...
def hello(name): """ Description: Accepts the name of an individual and prints "Hello ..." where the ellipsis represents the name of the individual. type(output) : str """ if type(name) == str: result = print("Hello " + name + "!") return result else: ...
def word_count(sentence): import re pat = re.compile('[^a-z0-9]+') words = [word for word in pat.split(sentence.lower()) if len(word) > 0] simple_freq = {} for word in words: simple_freq[word] = simple_freq[word] + 1 if word in simple_freq else 1 return simple_freq
import collections def _flatten(_in, depth): for item in _in: is_iterable = isinstance(item, collections.Iterable) is_string = isinstance(item, str) if is_iterable and not is_string: for _item in _flatten(item, depth+1): yield _item else: if ...
def hey(sentence): """ Bob is a lackadaisical teenager. In conversation, his responses are very limited. Bob answers 'Sure.' if you ask him a question. He answers 'Whoa, chill out!' if you yell at him. He says 'Fine. Be that way!' if you address him without actually saying anything. He answers 'Whatever.' to any...
def is_isogram(word): chars = list(word.lower()) chars.sort() prev = '' for char in chars: if char.isalpha(): if char == prev: return False prev = char return True
""" Below the first 12 numbers in the Fibonacci Sequence are declared in an array list (fibSeq). Part 1, Use a loop to print each of the 12 numbers. Part 2, use a loop to print each of the 12 numbers on the same line. """ fibSeq = ["1","1","2","3","5","8","13","21","34","55","89","144"]
def solveHW(r1,r2,dist): totalMPH = r1 + r2 time = dist/float(totalMPH) return time def distance(r,t): d = r*t return d print (distance(5,10)) """ create a function called distance give it a rate and time return the distance traveled """
class Solution(object): def reverse(self, x): """ 执行用时 :20 ms, 在所有 Python 提交中击败了92.39%%的用户 内存消耗 :11.7 MB, 在所有 Python 提交中击败了25.38%的用户 """ if x >= 2147483647 or x <= (-2147483648): return 0 if x < 0: return -self.act(-x) else: ...
""" Write a function which converts the input string to uppercase. """ def make_upper_case(s): return s.upper() def make_upper_case(s): return s.upper()
""" This is an application that store all the information of a book in a bookstore These are the things that a user can do in this application: search a book add a book update an entry delete close """ from tkinter import * import backend def get_selected_record(event): try: global selected_tuple i...
class Parent: class_var1 = 1 def __init__(self): self.param1 = 10 self.param2 = Parent.staticmethod1() self.param3 = self.staticmethod2() @staticmethod def staticmethod1(): return 20 @staticmethod def staticmethod2(): return 30 class child(Parent): ...
''' def funct_name (parameters): statements return (expression) x = funct_name(parameter_value) #x takes the value returned by function. #If the function dosen't return any value the x will take value 'None'. ''' def increment(val): val=val+1 print(val) re...
print('1.') print('-In composition, if the object of second class deletes then') print(' the object of first classs automatically deletes.') print('-But, in aggregation both the objects are intanstiated seperately,') print(' so they dont have an effect on each other.')
import os os.path.isfile('D://f1.txt') os.path.isdir('D://f1') open('D://text.txt','w') print('File created.') os.unlink('D://text.txt') print('File deleted.') try: os.mkdir('D://folder') except FileExistsError: pass try: os.unlink('D://folder') except PermissionError: print(...
print('Everything is object in python.') print('- ' + str(type(2))) print('- It is an object of class "int".')
from collections import namedtuple student = namedtuple('student','name age') print('Functions in namedtuple.') print('\nPrint field of tuple.') print(student._fields) s1 = ('Ash',21) s2 = ('Ashu',22) print('\nPrinting tuple of namedtuple.') t = (s1, s2) print(t) print(type(t[1]))
class unencapsulated: def __init__(self,rNo): self.roll_no = rNo class encapsulated: def __init__(self,rNo): self.__roll_no = rNo def getRollNo(self) : return self.__roll_no def changeRollNo(self,no): self.__roll_no = no unsafe = unencapsulated(1) print...
from abc import ABC, abstractmethod print('abstract method is the method user must implement in the child class.') print('abstract method cannot be instantiated outside child class.') print('\n\n') class parent(ABC): def __init__(self): pass @abstractmethod def square(): pass ...
import re message = ('Call at +91-9280690895 or +91-9920699095') RegExpObj = re.compile(r'\+\d\d-\d\d\d\d\d\d\d\d\d\d') m_o = RegExpObj.search(message) print('Printing results of searcch()') print(m_o) print(type(m_o)) print('\n\ngroup()') m_o = RegExpObj.search(message) if m_...
from topological_sort import topologicalSort def shortestPath(adjacent, edge_weight): topological_sort = topologicalSort(adjacent) start = topological_sort[0] distance = [float("inf") for i in range(len(adjacent))] distance[start] = 0 parent = {start:None} for node in topological_sort: ...
zlist = ["Fred", "Ralph", "Zelda", "Zoe"] print(type(zlist)) for index in range(len(zlist)): zlist[index] = "Guest " + zlist[index] print(zlist)
import hangman def bad_guess(x, word, letters): if x == 6: print(' _____') print(' | |') print(' O |') print(' |') print(' |') print(' |') print(' _____|\n') print('You have', x, 'more incorrect guesses!\n') elif x == 5: ...
import global_var import dice_roll import os import sys import view_dice import upper_lower import card import choice import time print('Welcome to Yahtzee!') card.card() def play(): print('Roll', global_var.roll_counter + 1) time.sleep(2) full_upper = False full_lower = False while f...
import global_var import time import card def upper_score(): score = (input('Where would you like to score? (1-6) ')) while score != '1' and score != '2' and score != '3' and score != '4' and score != '5' and score != '6': score = (input('Where would you like to score? (1-6) ')) if score == '0' o...
howManyContact = int(input("Enter the number of contacts you want to add: ")) contactDictionary = {} for i in range(0,howManyContact): name = input("Enter Name:") number1 = input("Enter number1:") number2 = input("Enter number2:") imageurl = input("Enter imageUrl:") email = input("Enter email:") websit...
def mutatesParams(mutableObjectParam): mutableObjectParam["newAddedProperty"] = "someValue" return mutableObjectParam someObject = { "key": "value" } returnValue1 = mutatesParams(someObject) print("newAddedProperty" in someObject.keys()) print("newAddedProperty" in someObject.keys()) print(someObject == retur...
num1=input() num2=input() if num1 > num2: print(num1) else: print(num2)
import time import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from shapely.geometry import Polygon, Point """ In this notebook you'll work with the obstacle's polygon representation itself. Your tasks will be: Create polygons. Sample random 3D points. Remove points contained ...
from typing import List class Solution: def removeElement(self, nums: List[int], val: int) -> int: if not nums: return 0 left, right = 0, len(nums) - 1 while left <= right: if nums[left] == val: is_true = False while right > left: ...
from typing import List class Solution: def generateMatrix(self, n: int) -> List[List[int]]: if n <= 0: return list() result = [[0 for _ in range(n)] for _ in range(n)] i, j = 0, 0 turns = ((0, 1), (1, 0), (0, -1), (-1, 0)) turn = 0 for k in range(1, n *...
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def printTree(self, root: TreeNode) -> List[List[str]]: def get_deep(node: TreeNode): if not node: return 0 ...
import random class RandomizedSet(object): def __init__(self): """ Initialize your data structure here. """ self.result = list() self.index = dict() def insert(self, val): """ Inserts a value to the set. Returns true if the set did not already contain ...
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ stack_l1 = list() stack_l2 = list() while l1 or ...
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def findFrequentTreeSum(self, root: TreeNode) -> List[int]: if not root: return list() self.result = dict() self.max_num...
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode: if not nums: return None max_num = max(nums) max_inde...
class Solution(object): def fractionToDecimal(self, numerator, denominator): """ :type numerator: int :type denominator: int :rtype: str """ first = 1 if numerator < 0: numerator = -numerator first = -first if denominator < 0: ...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def maxPathSum(self, root: TreeNode) -> int: self.result = int(-100) def get_result(node: TreeNode) -> int: if not node: return int(-100...
class Solution: def longestPalindrome(self, s: str) -> str: result = '' method = [[0, 1], [1, 0], [1, 1]] for i, char in enumerate(s): for met in method: left, right = i - met[0], i + met[1] while left >= 0 and right < len(s) and s[ ...
import collections class Solution: def longestPalindrome(self, s: str) -> int: a_dict = collections.Counter(s) result = 0 is_odd_number = False for char in a_dict: if a_dict[char] % 2 == 0: result += a_dict[char] else: is_odd_...
class Solution: def climbStairs(self, n: int) -> int: last_two = 1 last_one = 2 if n < 3: return n for i in range(n + 1): if i < 3: continue num = last_two + last_one last_two = last_one last_one = num ...
class Solution: def compressString(self, S: str) -> str: left, right = 0, 0 result = '' while right < len(S): while right < len(S) and S[right] == S[left]: right += 1 result += S[left] + str(right - left) left = right return result ...
class Solution: def isMatch(self, s: str, p: str) -> bool: m, n = len(s), len(p) result = [[False for _ in range(n + 1)] for _ in range(m + 1)] result[0][0] = True for i in range(1, n + 1): if p[i-1] == '*': result[0][i] = result[0][i - 1] else...
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def zigzagLevelOrder(self, root: TreeNode) -> List[ List[int]]: self.result = list() result = self.get_cal(root, 0) for i, l...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def getMinimumDifference(self, root: TreeNode) -> int: self.result = None self.last = None if not root: return self.result def get_result...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def pruneTree(self, root: TreeNode) -> TreeNode: if not root: return None left_result = self.pruneTree(root.left) right_result = self.pruneTree(ro...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def leafSimilar(self, root1: TreeNode, root2: TreeNode) -> bool: def get_result(node: TreeNode, result): if not node: return if not no...
import json from queue import Queue class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str """ ...
class Wifi(): def __init__(self): self.wifi_networks = [">[1] Wifi_network 1",">[2] Wifi_network 2",">[3] Wifi_network 3"] print("> Your available wifi networks are:") for i in self.wifi_networks: print(i) self.wifi_choice = input("Your choice?") if self.wifi_choi...
from typing import List class Solution: def rotate(self, matrix: List[List[int]]) -> None: n = len(matrix) for i in range(0,n-1): for j in range(i+1,n): matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j] i, j = 0, n-1 while i < j: for k i...
import pygame,random, time pygame.init() WIDTH,HEIGHT = 700,800 win = pygame.display.set_mode((WIDTH,HEIGHT)) pygame.display.set_caption("Pong") RED = (255,0,0) BLUE_LIGHT = (52, 232, 235) WHITE = (255,255,255) run = True x1=100 x2 = 700 y1 =350 y2 = 350 x3 =400 y3 = 400 player_score = 0 opponent_scor...
""" Created on Thu May 28 16:49:08 2020 @author: Rafael G. de Menezes Oceanographer, Msc. Marine Biotechnology Clube do Cientista Biosustente Estudos Ambientais ltda. Developed with Python 3.7.6 README: Python function to transform google earth .kml files list into a pandas DataFrame Necessary ...
import sqlite3 import pandas as pd from pandas import DataFrame query = """ CREATE TABLE test (a VARCHAR(20), b VARCHAR(20), c REAL, d INTEGER );""" con = sqlite3.connect(":memory:") con.execute(query) con.commit() data = [('Atlanta', 'Georgia', 1.25, 6), ('Tallahassee', 'Florida', 2.6, 3), ('Sacrame...
''' def test(): i = 7 return i print(test()) ''' def test2(i, j): '''this is a test function''' result = i * j return (i, j, result) ''' a = test2(4, 6) print(a[2]) ''' help(test2)
a = 3 if (a == 8): print("a = 8") elif (a == 9): print("a = 9") else: print("a != 8 && a != 9")
from PIL import Image from PIL import ImageDraw from PIL import ImageFont def resizeByWidth(img, toWidth, padding = 20): new_width = toWidth - padding new_height = new_width * img.size[1] // img.size[0] return img.resize((new_width, new_height), Image.ANTIALIAS) def resizeByHeight(img, toHeight,...
from math import pi r = float(input ("Input the radius of the circle : ")) print ("The area of the circle with radius " + str(r) + " is: " + str(pi * r**2)) fname = input("Input your First Name : ") lname = input("Input your Last Name : ") print ("Hello " + lname + " " + fname) import datetime now = datetime.datetim...
from tkinter import * from tkinter import ttk import sys, random from tkinter import messagebox LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def main(): myMessage = vv.get() myKey = 'HWERTUYIOPQSDFGAJKLZXCVBNM' myMode = v.get() if myMode == 'mode22': translated = encryptMessage(myKey, myMessage) ...
class Point: def __init__(self, row_init, col_init): self.row = row_init self.col = col_init def mid_left(self): return Point(self.row, self.col-1) def mid_right(self): return Point(self.row, self.col+1) def vert_left(self, vert_dir): return Point(s...
import cv2 trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') img = cv2.imread('pic2.jpg') grayscaled_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face_coordinates = trained_face_data.detectMultiScale(grayscaled_img) for (x,y,w,h) in face_coordinates: cv2.rectangle(img, (x...
import sys def this_fails(): x = 1/0 while True: try: x = int(input("Please enter a number: ")) this_fails() break except ValueError: print("Oops! That was no valid number. Try again...") except (RuntimeError, TypeError, NameError): pass except Zer...
a=[] n=int(input("Enter number of elements:")) for i in range(1, n + 1): b = int(input("Enter element:")) a.append(b) print(a) even=[] odd=[] for j in a: if(j%2==0): even.append(j) else: odd.append(j) print(even) print(odd)
print("7"+"7") print("7"*7)
from random import * x_boundary = 400 y_boundary = 400 x_coordinate = 200 y_coordinate = 200 speed_x = randrange (1,5) speed_y = randrange (1,5) def setup(): global x_coordinate global y_coordinate size(x_boundary,y_boundary) def draw(): global x_coordinate global y_coordinate global ...
""" This function applies distortion to a given audio signal by modelling the effects from a vacuum tube. Input parameters are the signal vector x, pre-gain G, "work point" Q, amount of distortion D, and pole positions r1 and r2 for the two filters used. @author: nk """ import numpy as np from scipy import signal fr...
''' URL and IMAGES from urllib SOCKET PROGRAMMING from socket SEND EMAILS from smtlib ''' import urllib.request try: url = urllib.request.urlopen('https://www.python.org/') content = url.read() url.close() except urllib.error.HTTPError: print("Page not found!") exit() f = open("python.html", 'wb...
import random card = [] suit = ["Clubs", "Spades", "Hearts", "Diamonds",] royals = ["Jack", "Queen", "King", "Ace"] deck = [] for i in range(2,11): card.append(str(i)) for j in range(4): card.append(royals[j]) for k in range(4): for l in range(13): cards = (card[l] + " of " + suit[k]) deck.append(car...
""" Classes representing products sold by Acme Corp """ import random class Product: """ Generic class for items sold by Acme Corp """ def __init__(self, name, price=10, weight=20, flammability=0.5): if not isinstance(name, str): raise AttributeError("'name' of Product must be a s...
my_list = [] if my_list: print(my_list) else: print("the list is empty") i = 0 while i < 10: print (i, end = " ") i += 1 names = ["hej", "niklas", "Erik"] for name in names: print(name, end = " ") print(i, end = "\U0001F606") for i in range(10): prin...
import ipdb from collections import deque GRAPH = { 0: {1, 2}, 1: {0, 3, 4}, 2: {0}, 3: {1, 5}, 4: {2, 3}, 5: {10, 2, 6}, 6: {10, 5, 7}, 7: {0, 1, 3}, 10: {0, 5, 6} } def bfs_traverse(graph, init_vertex): ipdb.set_trace() visited = [init_vertex] queue = deque([init_ve...
amount = input("What is the order amount? ") state = input("What is the state? ") amount = float(amount) tax = amount * 0.055 total = amount + tax if state == 'WI': print(f"The subtotal is ${amount:.2f}") print(f"The tax is ${tax:.2f}") print(f"The total is ${total:.2f}")
noun = input("Enter a noun: ") verb = input("Enter a verb: ") adjective = input("Enter an adjective: ") adverb = input("Enter an adverb: ") msg = f"Do you {verb} your {adjective} {noun} {adverb}? That's hilarious!" print(msg)
from math import ceil width = input("Width : ") height = input("Height : ") width = float(width) height = float(height) square_meters = width * height liters = ceil(square_meters / 9) msg = f"You will need to purchase {liters} liters of paint to cover {square_meters} square meters" print(msg)
people = input("How many people? ") pizzas = input("How many pizzas do you have? ") print() pieces = input("How many pieces are in a pizza? ") people = int(people) pizzas = int(pizzas) pieces = int(pieces) total_pieces = pizzas * pieces per_pieces = total_pieces // people leftover = total_pieces % people msg...