阅读背景:

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

来源:互联网 

1、错误描述

>>> num=input('请输入一个整数:');
请输入一个整数:78
>>> if num  < 10:
	num=10;
	print("你输入的整数小于10");
	elif num < 20:
		
SyntaxError: invalid syntax
>>> if num<10:
	num=10;
	print("小于10");
elif num < 20:
	num=20;
	print("小于20");
else:
	print(num);

	
Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    if num<10:
TypeError: '<' not supported between instances of 'str' and 'int'
>>> >>> num=input('请输入一个整数:');
请输入一个整数:



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: