
这样print就会一直运行,试过加break,但那就打不到7-5的要求了

烦请各位老哥帮忙看看
while age_price是一个死循环,因为 age_price恒定为真,要么不进入循环要么死循环,需要在内部break进行打破
while True:
n=input()
if n=='quit': #先判断是否结束
print('end')
break
n=int(n) #默认输入都是数字
if n<3:
price = 0
elif n<12:
price=10
else:
price=15
print(f'you need to pay {price} for tickets')