-2
我正在做一個三明治店的計劃。三明治店python
我是新來的python,所以我需要一點幫助!
print "Welcome to the sandwich shop!"
name = raw_input("What is your name?")
sandwich = int(raw_input("How many sandwiches do you want?"))
cookie = int(raw_input("How many cookies do you want?"))
mint = int(raw_input("How many mints do you want?"))
sandwich_price = 0.5
cookie_price = 0.05
mint_price = 0.01
print sandwich_price + cookie_price + mint_price
sandwich * sandwich_price = sandwich_price_total
cookie * cookie_price = cookie_price_total
mint * mint_price = mint_price_total
sandwich_price_total + cookie_price_total + mint_price_total = total_order
print ("THe order will be %r dollars!") , total_order
penny = 0.01
nickel = 0.05
dime = 10
quater = 25
dollar = 1
print "Please pay in cash or credit card!"
question1 = raw_input("> ")
if question1 == credit:
print "%r you got %r dollars from your account." % (name, total_order)
if question1 == cash:
print "You paid %r dollars!" % total_order
print "Thank you for coming %r" % name
我收到此錯誤:
你的許多作業都是向後的。請找到並按照介紹[教程](http://sopython.com/wiki/What_tutorial_should_I_read%3F)。 – jonrsharpe
在賦值(即'='運算符)中,您分配的內容應位於左側。所以,例如,'sandwich * sandwich_price = sandwich_price_total'應該是'sandwich_price_total = sandwich * sandwich_price'。 –
此外,原始輸入返回一個字符串,所以比較應該是字符串「信用」和「現金」而不是術語。 (這會給自己的錯誤) – ANVGJSENGRDG