我的任務是以下如何在列表中將字符串連接在一起?
寫菜單,用4個不同的美食選擇在線餐飲服務,即:墨西哥
每個菜餚都應該有至少5點不同的選擇,如咖喱然後咖喱汁然後熱咖喱等。它應該用訂單號打印出用戶的最終訂單。
我的問題是怎麼做我一起度過的順序,然後加入一些字符串列表,例如:加入熱水以蔬菜咖喱,但目前它把它放在不同的順序
最後使代碼高效我應該使用def函數嗎? 這是當前的代碼。 進口隨機
print("Welcome to Hungry Horse...")
print("We have wide range of food choice from all around the world")
print("We have food choices from: Indian/Italian/Chinese/Mexican")
foodList = ([])
drinkCho = input("Lets start with drinks. State if you would like drinks yes or no").lower()
if drinkCho == "yes":
drinkCho2 = input("Which drink do you want? We have option of:Coke/Fanta/Cobra/Water/FruitShoot").lower()
if drinkCho2 == "coke":
foodList.insert(1,drinkCho2)
print("You have chosen coke.A great choice")
if drinkCho2 == "fanta":
foodList.insert(2,drinkCho2)
print("You have chosen fanta.A great choice")
if drinkCho2 == "cobra":
foodList.insert(3,drinkCho2)
print("You have chosen cobra.A great choice")
if drinkCho2 == "Water":
foodList.insert(4,drinkCho2)
print("You have chosen Water.A great choice")
if drinkCho2 == "fruitshoot":
foodList.insert(5,drinkCho2)
print("You have chosen fruitshoot.A great choice")
elif drinkCho == 'No':
print("Ok no problem lets move on to the staters")
mainCho = input("Which type of mains would you like:Indian/Italian/Chinese/Mexican").lower()
if mainCho == "Indian":
print("Get ready to be enticed by the rich spicy falvors of Indian cusine")
indCho = input("What would you like to order: curry/onion bhaji/samosa")
if indCho == "curry":
foodList.insert(indCho)
curryCho = input("What curry would you like: chicken curry/lamb curry/ veg curry")
if curryCho == "veg curry":
print("Thats a excellent choice")
foodList.insert(6,curryCho)
elif curryCho == "lamb curry":
print("Thats a excellent choice")
foodList.insert(7,curryCho)
elif curryCho == "chicken curry":
foodList.insert(8,curryCho)
print("Thats a excellent choice")
else:
print("inncorrect input")
curryCho = input("What curry would you like: chicken curry/lamb curry/ veg curry")
foodList.insert(curryCho)
indSide = input(str("What do you want to eat the delicious with the curry naan bread/rice or both"))
if indSide == "naan bread":
foodList.insert(9,indSide)
elif indSide == "rice":
foodList.insert(10,indSide)
elif indSide == "both":
foodList.insert(11,indSide)
spiceAn = input("How spicy would you like your curry to be:hot/medium/mild").lower()
if spiceAn == "Hot":
print("ooh you must a man!")
foodList.insert(12,spiceAn)
elif spiceAn == "Medium":
print("That is a safe option")
foodList.insert(13,spiceAn)
elif spiceAn == "Mild":
("You don't seen to like spicy food!")
foodList.insert(14,spiceAn)
rnd = (int(random.randrange(100)) + 1)
print ("Your final order", foodList ," Your order number is", rnd, "Please wait until we process your order")
也許你.. –
這是不是「我們做你的功課」服務... – Stophface
爲什麼你們不喜歡的職位,但沒有給出理由 –