代码组2是由代码组1复制粘贴,并将age替换成input(prompt)得来
为什么代码组2没有打印age=1、34时的票价呢
代码组2的代码如下
#询问年龄,给出票价,quit退出
prompt = "How old are you?"
acitve = True
while active:
if input(prompt) == "quit":
break
else:
if int(input(prompt)) < 3:
price = 0
elif int(input(prompt)) < 16:
price = 10
else:
price = 20
print("The price is ", price)
初学python的菜鸡求问