Simple program question.

russ.pobox at gmail.com russ.pobox at gmail.com
Tue Jun 11 03:25:39 EDT 2013


input() is a function which returns a string. You can assign this return value to a variable. That's what variables are for.

option = input()

Now you can use the variable named option in place of all those calls to input().

i.e:

...instead of..

if input() == 'parry':
    # etc

...do this...

option = input()
if option == 'parry':
    # etc
elif option == 'whatever':
    # etc



More information about the Python-list mailing list