这是我写的
prompt='\n本电影院分年龄段收费,请输入您的年龄:'
prompt+="\n(Enter 'quit' when you are finished)"
while True:
age=int(input(prompt))
if age<3:
print('您无需支付费用。')
elif 3<=age<=12:
print('您需要支付10美元。')
elif age>12:
print('您需要支付15美元。')
elif age=='quit':
break
else:
print("请输入阿拉伯数字。")
当我输入“二十”的时候就出错了,我是希望它能够提醒“请输入阿拉伯数字。”
报错信息:
本电影院分年龄段收费,请输入您的年龄:
(Enter 'quit' when you are finished)二十
Traceback (most recent call last):
File "D:\Python_Practice\7-5 电影票.py", line 5, in <module>
age=int(input(prompt))
ValueError: invalid literal for int() with base 10: '二十'
>>>