More homework.
This commit is contained in:
parent
21a30c7f10
commit
47cdaef904
BIN
week 2/Superslides inc.docx
Normal file
BIN
week 2/Superslides inc.docx
Normal file
Binary file not shown.
54
week 2/superslides.py
Normal file
54
week 2/superslides.py
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user