I have the following simple python code, which checks the user input.
num = raw_input("Enter the number :")
if (num >= 1 and num <= 5):
print "Error! Enter again :"
num is a string, not a number. You need to convert the return value of
raw_input into a number first with
>>> n = raw_input('Type stuff: ') Type stuff: 123 >>> type(n) <type 'str'> >>> n '123' >>> int(n) 123 >>> type(int(n)) <type 'int'>