##Example 1 print("Please enter the ages of the customers one line at a time. \nEnter -1 when there are no more customers.") age = int(input("Age: ")) bill = 0 while age != -1: if age <= 2 and age > 0: bill = bill elif age <=12 and age>2: bill = bill + 4.50 elif age >=65: bill = bill + 7.50 elif age > 12 and age < 65: bill = bill + 9 elif age < -1: quit() age = int(input("Age: ")) bill = '{:,.2f}'.format(bill) print("The total bill is $"+str(bill)) quit() ######################### ##Example 2 print("Please enter the ages of the customers one line at a time.") print("Enter -1 when there are no more customers.") age = int(input("Age: ")) price = 0 while age!=-1: if age>=3 and age<=12: price = price + 4.50 elif age>=65: price = price + 7.50 elif age>12 and age<65: price = price + 9 age=int(input("Age: ")) price = '{:,.2f}'.format(price) print("The total bill is $",price) ######################### ##Example 3 print("Please enter the ages of the customers one line at a time") print("Enter -1 when there are no more costomers") customers = True total=0 while customers: age=int(input("Age: ")) if age==-1: customers = False elif age <=2: total=total+0 #print(total) elif age >2 and age <=12: total=total+4.5 #print(total) elif age >12 and age <65: total=total+9 #print(total) elif age >=65: total=total+7.5 #print(total) print("The total bill is $",'{:,.2f}'.format(total))