编程的新手。试图使用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