[Tutor] check_range

R. Alan Monroe amonroe at columbus.rr.com
Wed Dec 15 00:27:47 CET 2004


> def check_range(myrange):
>         if range(myrange) != range(10,89):
>                 return "False"
>         else:
>                 return "True"

For this to work out, the user's input would have to be a giant string
containing 10, 11, 12, 13, etc.

Unless I mistunderstood your requirements, what you're probably looking for is:

if myrange in range(10,90):  # "in" is the key word here
    return True
else
    return False



More information about the Tutor mailing list