編程的新手。試圖使用Head First Programming書自學。 我無法得到以下代碼來工作;函數不能在Python中工作
def make_smoothie():
juice = input("What juice would you like?")
fruit = input("Ok- and how about the fruit?")
print "Thanks. Lets go!"
print "Crushing ice..."
print "Blending the %d" % fruit
print "Now adding in the %d juice" %juice
print "Finished! There's your %d and %d smoothie" %(fruit, juice)
print ("Welcome to smoothie")
another ="Y"
while another=="Y":
make_smoothie()
another = input ("How about another (Y/N)?")
不斷得到對於果汁或水果的輸入沒有定義
嘗試用'%s'替換%D'的'實例 – MattDMo 2014-11-06 00:56:05
同樣的錯誤,對於果汁輸入沒有被定義。 – 2014-11-06 01:01:20
看到我的答案...它的原因,代碼是爲python3,但你使用python 2 ...和用戶輸入方法有點不同 – 2014-11-06 01:02:46