【发布时间】:2022-12-18 09:40:01
【问题描述】:
我用 Python 编写了以下程序,但出现此错误 请指导我
age= (input("please inter your age:" ))
if age > 40:
print ("old")
elif 40>age>=30:
print ("middle-age")
elif 30>age>=20:
print ("yong")
TypeError: '>' not supported between instances of 'str' and 'int'
我检查了几次程序
【问题讨论】:
-
为什么使用 Java 标签,因为代码是用 Python 编写的?
-
这回答了你的问题了吗? How can I read inputs as numbers?
标签: python python-3.x python-2.7 syntax