diff --git a/6-functions/33_drive_thru.py b/6-functions/33_drive_thru.py index 04a1aa3..7814c15 100644 --- a/6-functions/33_drive_thru.py +++ b/6-functions/33_drive_thru.py @@ -1,30 +1,19 @@ # Drive-Thru πŸš™ # CodΓ©dex -def get_item(x): - if x == 1: - return 'πŸ” Cheeseburger' - elif x == 2: - return '🍟 Fries' - elif x == 3: - return 'πŸ₯€ Soda' - elif x == 4: - return '🍦 Ice Cream' - elif x == 5: - return 'πŸͺ Cookie' - else: - return "invalid option" +menu = ['Cheeseburger', 'Fries', 'Soda', 'Ice Cream', 'Cookie'] + +def get_item(i): + return(menu[i - 1]) def welcome(): - print('Welcome to Sonnyboy\'s Diner!') - print('Here\'s the menu:') - print('1. πŸ” Cheeseburger') - print('2. 🍟 Fries') - print('3. πŸ₯€ Soda') - print('4. 🍦 Ice Cream') - print('5. πŸͺ Cookie') + print("Welcome! Here is our menu:") + print(menu) welcome() -option = int(input('What would you like to order? ')) -print(get_item(option)) +order = int(input("What would you like to order? ")) +if order > 5: + print("Invalid order.") +else: + print(get_item(order))