无限空间的菜单选项?

时间:2017-01-29 18:49:23

标签: python menu

所以我试图制作这个交互式菜单,但前两个选项不起作用。这是代码:

from time import sleep
value = 0
price = 0


def restaurant():
    first = input('What is your first name: ')
    last = input('What is your last name: ')
    print('\nStarting order for', first.strip().lower().title(), last.strip().lower().title() + '.\n')
    print("•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••")
    print("•••••••••••WELCOME TO RAVA ITALIAN RESTAURANT••••••••••••")
    print("•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••")
    print("{1} Order from the menu")
    print("{2} Review your bill")
    print("{3} Complete your transaction")
    return int(input('What would you like to do?'))

value = restaurant()

def show_menu():
    print('Here is our delicious menu! Type in a number to view the category.')
    print("{1} Pasta")
    print("{2} Pizza")
    print("{3} Beef")
    print("{4} Chicken")
    print("{5} Go Back")
    return int(input('What would you like to do?'))


def pasta():
    print('Here are your options: ')
    print('{1} Linguine with White Wine and Clams - $14.00')
    print('\n{2} Penne a la Vodka - $12.50')
    print('\n{3} Lasagna - $13.50')
    print('\n{4} Go Back')
    for i in range(40):
        print()

def pizza():
    print('Here are your options: ')
    print('{1} Classic Pizza with Sauce, Cheese, and Basil - $15.00')
    print('\n{2} White Pizza with Cheese and Spinach - $15.50')
    print('\n{3} Meat Lovers Pie with Meatballs, Sausage, and Prosciutto - $14.50')
    print('\n{4} Go Back')

def beef():
    for i in range(40):
        print()
    print('Here are your options: ')
    print('{1} NY Strip Steak - $14.00')
    print('\n{2} Grilled Steak with Mushroom and Onion Sauce - $12.50')
    print('\n{3} Meatball Hero with Mozzarella Cheese - $13.50')
    print('\n{4} Go Back')

def chicken():
    for i in range(40):
        print()
    print('Here are your options: ')
    print('{1} Chicken Parmigiana - $14.00')
    print('\n{2} Chicken Marsala - $11.50')
    print('\n{3} Chicken Picatta - $11.00')
    print('\n{4} Go Back')

def main():
    while value != 3:
        for i in range(40):
            print()

        #Use their choice
        if value == 1:
            value2 = show_menu()

            if value2 == 1:
                value3 = pasta()
                value4 = pizza()
                value5 = beef()
                value6 = chicken()
                if value3 == 1:
                    price = price + 14
                elif value3 == 2:
                    price = price + 12.5
                elif value3 == 3:
                    price = price + 13.5

                if value4 == 1:
                    price = price + 15
                elif value4 == 2:
                    price = price + 15.5
                elif value4 == 3:
                    price = price + 14.5

                if value5 == 1:
                    price = price + 14
                elif value5 == 2:
                    price = price + 12.5
                elif value5 == 3:
                    price = price + 13.5

                if value6 == 1:
                    price = price + 14
                elif value6 == 2:
                    price = price + 11.5
                elif value6 == 3:
                    price = price + 11

            if value == 2:
                for i in range(10):
                    print()
                    print('Your total so far is', price + '.')
                    sleep(3)



main()

好的,所以选项1及其子菜单和选项2都不起作用。如果你有空闲时间,你介意看看吗?感谢。

0 个答案:

没有答案