More homework.

This commit is contained in:
winneratwin 2022-02-15 15:58:26 +00:00
parent 21a30c7f10
commit 47cdaef904
Signed by: winneratwin
GPG Key ID: CDBC42F8803D689E
2 changed files with 54 additions and 0 deletions

BIN
week 2/Superslides inc.docx Normal file

Binary file not shown.

54
week 2/superslides.py Normal file
View File

@ -0,0 +1,54 @@
import os
from time import sleep
from datetime import date
def int_input(text):
while True:
try:
user_input = int(input(text))
return user_input
except Exception:
print("error")
else:
break
def screen_clear():
# for mac and linux(here, os.name is 'posix')
if os.name == 'posix':
_ = os.system('clear')
else:
# for windows platfrom
_ = os.system('cls')
is_weekend = date.today().isoweekday() > 5
adult_price=10
kid_price=5
total = 0
in_service = True
screen_clear()
print("Welcome to Superslides inc.")
while in_service:
adults = int_input("Enter number adult customers: ")
kids = int_input("Enter number children: ")
if not is_weekend:
price = adults * adult_price + kids*kid_price
else:
price = (adults+kids)*kid_price
print("Order price:",price)
total += price
want_to_continue = input("Do you want to process another customer?: ").lower()
screen_clear()
match want_to_continue:
case "yes":
continue
case "y":
continue
case _:
in_service=False
print("Daily total:",total)
sleep(15)