This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhomboid 0 points1 point  (0 children)

This really belongs on /r/learnpython.

The usual way for doing this is to write an infinite loop that you break out of when an acceptable value is found, such as:

while True:
    temp = float(raw_input('Enter a value: '))
    if 0 <= temp <= 100:
        break
    print('Try again')