怎么也搞不好
代码:
# coding:utf-8
number=['1','2','3','4','5','6','7']
lennum=len(number)
num=input('请猜一个数字')
if num>=lennum:
print('太大了!')
elif num<=lennum:
print('太小了!')
else:
print('恭喜你猜对了!')
报错:
Traceback (most recent call last):
File "D:\XXXXXXXX\XXXXXX\XX\XXXXX\XX.py", line 5, in <module>
if num>=lennum:
TypeError: '>=' not supported between instances of 'str' and 'int'
谁能解决一下?