This statement:
num = raw_input("Choose a number: ")
does num a string , not a number, despite its misleading name. It so happened that Python 2 allows you to compare strings with numbers, and in your version all strings larger than all numbers are taken into account (the contents of the string do not matter).
Use num = int(num) to make an integer (and be sure to use try / except to catch possible errors when the user typed something other than the number!) Before starting the comparison.
(In Python 3, the function name changes from raw_input to input , and it still returns strings, however in Python 3 comparing a string with a number is considered an error, so you should get an exception, not True or False in each of your comparison attempts).
source share