"Brian van den Broek" <[EMAIL PROTECTED]> said: >Marc Gartler said unto the world upon 2004-12-14 18:12: >> Hi all, >> >> I am fairly new to both Python & programming, and am attempting to >> create a function that will test whether some user input is an integer >> between 10 and 89, but the check isn't happening... >> >> def check_range(myrange): >> if range(myrange) != range(10,89): >> return "False" >> else: >> return "True" >> >> ...this gets called later via: >> if check_range(input): >> done = "True" >> return int(input) >>
[...] >I have a some style suggestions for you, too. > >Try it this way: > > >>> def check_in_range(value): > in_range = False > if 9 < value < 90: > in_range = True > return in_range > > >>> check_in_range(35) >True > Shorter: def check_in_range(value): return 9 < value < 90 [...]
_______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor