Thanks for the many replies. Thanks especially to Pierre. This works
perfectly:
def getName():
name = input('Please enter your name: ')
print('Hello', name)
def getAge():
while True:
try:
age = int(input('Please enter your age: '))
return age
except ValueError:
print('That was not a valid number. Please try again.')
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.')
getName()
a = getAge()
checkAge(a)
I am running Python 3, sorry for not stating that originally.
--
http://mail.python.org/mailman/listinfo/python-list