Untitled
unknown
plain_text
3 years ago
1.1 kB
14
Indexable
Never
print('Sample menu:') print('\tFood and Drinks Purchased') print('1. Food') print('2. Drinks') print('3. Exit\n') food_total = 0 drinks_total = 0 selection = int(input('Please enter your selection: ')) while selection >=1 and selection <=3: if selection == 1: # Add input to running total. food_total += food_total # Get input from user. food_total = float(input('What was the cost of food purchased? $')) selection = int(input('\nPlease enter your selection: ')) elif selection == 2: # Add to running total. drinks_total += drinks_total # Get input from user. drinks_total = float(input('What was the cost of drinks purchased? $')) selection = int(input('\nPlease enter your selection: ')) elif selection == 3: print('\n\tTotal Purchases') print(f'\nTotal food: ${food_total:12.2f}') print(f'Total drinks: ${drinks_total:10.2f}') break else: print('\nERROR: You must enter a selection from the list above.')