simonh a écrit :
Thanks for the many replies. Thanks especially to Pierre. This works
perfectly:

(snip)

Ok, now for some algorithmic stuff:

def checkAge(age,min=18,max=31):
    if age in list(range(min, max)):
        print('Come on in!')
    elif age < min:
        print('Sorry, too young.')
    elif age >= max:
        print('Sorry, too old.')


if age is neither greater than max nor lesser than min, then it's it in range(min, max). IOW, you could just skip the first test:


def checkAge(age,min=18,max=31):
    if age < min:
        print('Sorry, too young.')
    elif age >= max:
        print('Sorry, too old.')
    else:
        print('Come on in!')

!-)


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to