Untitled

 avatar
unknown
plain_text
3 years ago
1.2 kB
23
Indexable
print('Sample menu:')
print('\tFood and Drinks Purchased')
print('1. Food')
print('2. Drinks')
print('3. Exit\n')

selection = int(input('Please enter your selection: '))

while selection >=1 and selection <=3:
    if selection == 1:
        for food_total in range(1):
            # Get input from user.
            food_total = float(input('What was the cost of food purchased? $'))
            # Add input to running total.
            food_total += food_total
            selection = int(input('\nPlease enter your selection: '))
    elif selection == 2:
         for drinks_total in range(1):
            # Get input from user.
            drinks_total = float(input('What was the cost of drinks purchased? $'))
            # Add to running total.
            drinks_total += drinks_total
            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.')
Editor is loading...