Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 33_drive_thru.py #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions 6-functions/33_drive_thru.py
Original file line number Diff line number Diff line change
@@ -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))