def inputAge():
age = input("Input your age:")
if (age>100 or age<18):
raise ’BadNumberError’, ’out of range’
return age
TypeError: ‘>’ not supported between instances of ‘str’ and ‘int’。
如果用的是Python3.x ,函数input 返回值是 string,所以需要加一个int将string转换成int。