Python - 类型错误:'<''str' 和 'int' 的实例之间不支持 [英] Python - TypeError: '<' not supported between instances of 'str' and 'int'
本文介绍了Python - 类型错误:'<''str' 和 'int' 的实例之间不支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编码初学者,目前在 Python3 上,抱歉打断我正在测试的这个模型.
BEGINNER in coding and currently on Python3, sorry to interrupt with this mock up I'm testing.
出现类型错误:'<'在第 3 行的 'str' 和 'int' 实例之间不支持.我很确定在请亮灯后还有其他错误,谢谢!
Got an TypeError: '<' not supported between instances of 'str' and 'int' at line 3. Which I'm quite sure there are other errors after kindly shed lights, thanks!
def main():
age = int(input ('Enter you age'))
if age<18:
print ('Sorry')
else:
print ('Welcome')
main()
推荐答案
您的缩进有误,请改正!你的代码没问题
Your indentation is wrong, please fix that! Your code is fine
def main():
age = int(input ('Enter you age'))
if age<18:
print ('Sorry')
else:
print ('Welcome')
main()
它对我来说很好
Enter you age12
Sorry
这篇关于Python - 类型错误:'<''str' 和 'int' 的实例之间不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文