raw_input
returns a string. This means you are comparing a string to an integer for your while
condition. A quick test shows integers are always "less than" strings.
>>> 10000 > '1'
False
>>> 10000 < '1'
True
Luckily, this behavior is changed in python3
where it throws a TypeError
.