+ 1
What mistake I am doing?
4 Answers
0
By default input value is string.
So if you want to compare values in if as int, you need cast x to int, like
if int(x) < 10:
Or if you need to compare this values as string, you need to cast 10 to string.
+ 13
input() is used to scan a string. You should use int(input()) to scan an integer. Try this.
x = int(input("enter a no"))
if x < 10:
print ("less than 10")
0
Thanks for the help