[Tutor] Case acceptance using raw_input
Alan Gauld
alan.gauld at freenet.co.uk
Wed Feb 16 07:40:58 CET 2005
> Is there a better way for raw_input to accept both caps and lower
case
> letters than:
>
> def aFunction():
> action = raw_input("Perform an action?(y,n): ")
> if action == 'y' or action == 'Y':
if action in 'yY':
> anotherFunction()
> elif action == 'n' or action == 'N':
elif action in 'nN':
> yetAnotherFunction()
> else:
> aFunction()
HTH,
Alan G
More information about the Tutor
mailing list