2 回答
TA貢獻1802條經驗 獲得超10個贊
這是整個固定代碼
menu = ("Happy Ham's Pizza Hut \n\nSIZES \nLarge pizza (20in.) \nMedium pizza
(15in.) \nSmall pizza (personel 10in.)\n")
menu += ("\nTYPES \nVegan pizza(non-dairy cheese, tofu pepporoni)\nVegatarian
pizza(ground-corn crust, graded radish cheese alternative, cucumber
rounds)")
name = str(input(" \n Hello, and welcome to happy ham's pizza hut! \nWould you
like a menu? \n >>"))
if name in ('yes', 'yes please'):
print(menu)
else:
print("Customer doesn't want to see menu")
TA貢獻1934條經驗 獲得超2個贊
只是幾個變化,一切看起來都很好。
menu = ("Happy Ham's Pizza Hut \n\nSIZES \nLarge pizza (20in.) \nMedium pizza
(15in.) \nSmall pizza (personel 10in.)\n")
menu += ("\nTYPES \nVegan pizza(non-dairy cheese, tofu pepporoni)\nVegatarian
pizza(ground-corn crust, graded radish cheese alternative, cucumber
rounds)")
name = str(input(" \n Hello, and welcome to happy ham's pizza hut! \nWould you
like a menu? \n >>"))
acceptableresponses = ["yes", "yes please", "YES!"]
### create a list of acceptable responses to display the menu.
if name in acceptableresponses:
print(menu)
else:
print("Customer doesn't want to see menu")
### else case doesn't show menu rather prints a msg saying user doesn't want to see the menu since user input something other than what's in the list declared.
添加回答
舉報
