如何修复'str'和'int'实例之间不支持的'<

时间:2019-07-13 15:26:31

标签: python-3.x

我正在做一本书的作业,但无法解决问题:

'<' not supported between instances of 'str' and 'int'

我的代码是:

message = 'How old are you?: '
message += "\nType 'quit' for exit: "

age = int(input(message))

if age < 3:
    price = 0 

elif age >= 3 and age < 12:
    price = 10 

else:
    price = 15

print("Bilet cost: " + str(price) + "$")

0 个答案:

没有答案