Reputation: 11
I wanted to make a menu for a restaurant. Because I am new, I wanted to make not a lot of choices so I got a random excuse but that's not my problem right now. I just need help as when I do my if/else/elif statement, well either I don't know how to use it or I just have a mistake in my code pls help... so this is what I have so far:
import sys
def _menu_():
print('|--------------------------------|')
print('|Kids menu: |')
print('| Chicken nuggets(G) 3$|')
print('| Medium size MAC(G) 5$|')
print('| EXTRA Fries (GF) +1.50$|')
print('|*all menu comes with fries* |')
print('|G = GLUTEN GF = GLUTENFREE |')
print('|--------------------------------|')
def _menu_COTD():
print('|--------------------------------|')
print('|CATCH OF THE DAY: |')
print('| Beef tenderloin (grilled) 24$|')
print('| Grilled salmon,tuna/mayo 12$ |')
print('| G = GLUTEN GF = GLUTENFREE |')
print('|--------------------------------|')
def _menu_BOTH():
print('|--------------------------------|')
print('|Kids menu: |')
print('| Chicken nuggets(G) 3$|')
print('| Medium size MAC(G) 5$|')
print('| EXTRA Fries (GF) +1.50$|')
print('|*all menu comes with fries* |')
print('|G = GLUTEN GF = GLUTENFREE |')
print('|--------------------------------|')
print(' ')
print(' ')
print('|--------------------------------|')
print('|CATCH OF THE DAY: |')
print('| Beef tenderloin (grilled) 24$|')
print('| Grilled salmon,tuna/mayo 12$|')
print('| G = GLUTEN GF = GLUTENFREE |')
print('|--------------------------------|')
print('Owner:')
print ('hello, i am the owner of the restaurant, unfortunately we have been robbed and all our food is gone except for our catch of the day and our kids menu')
print(' ')
print('is it ok or you want to go to another restaurant (knowing that our prices reduced by 75%)')
print('write "yes" if you want to eat here and write "no" to go somewhere else')
menu_choice = input('will you stay?')
if menu_choice == 'yes':
print('ok great so what will you take?')
else:
print('ok then, enjoy you expensive other restaurant')
sys.exit()
menu_choice_2 = input('Kids menu, Catch of the day, or both?')
if menu_choice_2 == 'kids menu':
_menu_
if: menu_choice_2 == 'Catch of th day':
_menu_COTD
if: menu_choice_2 == 'Both':
_menu_BOTH
so when it says menu_choice_2
I basically want to have either _menu_
(the kids menu) _menu_COTD
(the catch of the day) and _menu_BOTH
(which is both, _menu_
and _menu_COTD
. Pls, help. I don't know how to fix this.
Upvotes: 0
Views: 120
Reputation: 2484
There are two errors.
First, there are unnecessary colon(:) for the last two if statement.
Second, you need a parenthesis to call the function (e.g., menu())
I just fixed the last part of the code, so that you can call the functions:
if menu_choice_2 == 'kids menu':
_menu_()
if menu_choice_2 == 'Catch of th day':
_menu_COTD()
if menu_choice_2 == 'Both':
_menu_BOTH()
Upvotes: 2
Reputation: 308
You're gonna have to call your function. Right now when you write menu, it evaluates to nothing. Instead, write _menu_()
and same for other functions too.
Also you have a typo in your last if statements, remove the colons from in front of if
statements
Upvotes: 0