+ 1
TypeError: unorderable types: str() > int() please help in explaining this error
#Why is this code wrong? num = input ('enter number') if num > 5: print("Bigger than 5") if num <=47: print("Between 5 and 47")
3 odpowiedzi
+ 2
You must convert the input from a string to an integer. You can't compare a string with an int :)
+ 1
Try this:
num = int(input("enter number"))
# You have to convert input() to int as it returns a string by default
0
thanks a lot. so it takes input in form of string and i should convert it to integer using function int. got it. :) cheers!