-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex10
35 lines (29 loc) · 973 Bytes
/
ex10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Self-Checkout Exercise"""
def main():
"""Runs prompts"""
subtotal = user_selection()
calculation(subtotal)
def user_selection():
"""Prompts user for price of items"""
counter = 1
subtotal = 0
shopping = True
while shopping != False:
item_price = int(input("Please enter the price of item {}. Enter -1 if you have no more items: ".format(counter)))
if item_price == -1:
shopping = True
return subtotal
quantity = int(input("Please enter quantity of item {}: ".format(counter)))
total_set_value = item_price*quantity
subtotal += total_set_value
counter+=1
return subtotal
def calculation(subtotal:int):
tax_constant = 1.055
tax = round(subtotal*.055,2)
total = round(tax_constant*subtotal,2)
print("Subtotal: ${}".format(subtotal))
print("Tax: ${}".format(tax))
print("Total: ${}".format(total))
if __name__ == '__main__':
main()