Grocery
Activity #3Jideeh
python
a year ago
1.0 kB
4
Indexable
input_product = input("Welcome to Dalli! What can I get for you? ")
print("You'll be buying " + input_product + ", is that right?")
while True:
try:
input_cost = int(input("How much does your product cost? "))
print("Okay, then you will be paying " + str(input_cost) + ".")
break
except ValueError:
print("Uhm, please give me a number, not a word.")
while True:
try:
input_money = int(input("How much money will you be paying with? "))
print("I received " + str(input_money) + ".")
break
except ValueError:
print("Uhm, please give me a number not a word.")
if input_cost > input_money:
print("Your money is insufficient by " + str(input_cost - input_money))
elif input_money > input_cost:
print("Your change is " + str(input_money - input_cost))
elif input_money == input_cost:
print("You paid the exact amount of the product. Thank you for shopping, please come back again!")Editor is loading...
Leave a Comment