错误的代码
a=print('请输入a:')
if a>10:
print(a,'>10')
else
print('知不知道你输入的有问题?')
运行上述代码就会报错
not supported between instances of 'str' and 'int'
然后,查询才知道,python的input()返回的数据类型是str类型,不能直接和整数进行比较,必须先把str转换成整型,使用int()方法:a = int(input ('请输入a:')),这才正常运行,对于我这小白来说,一点一点积累了。