0

I was writing a text adventure in python and i ran into a "NameError: name 'military' is not defined" error and i need help, heres the code

this is the part with the prob:

choice = raw_input("Pick your civ:")
            if choice == military:

thnx for your time

--
Tom tetlaw
i rule

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by tomtetlaw
0

raw_input returns a string, so your test should be

if choice == "military":
    ...

With your code, python thinks that military is a variable's name and complains because there is no such variable.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.