【发布时间】:2017-02-09 10:14:09
【问题描述】:
我是编程新手。如果我在 Python 中使用 if else 语句输入字符串,如何得到错误消息。
x = int(input("Enter the no."))
if (x>5):
print (x ,'Is greater than 5')
elif (x==str):enter code here
print('Incorrect input')
elif (x==5):
print (x ,'Is equal to 5')
elif (x<5):
print (x ,'Is less than 5')
else:
print (x ,'none of the above!')
【问题讨论】:
-
输入任何非数字的内容
标签: python