Nested if statements considered good practice?
Limit on how deep if statements can be nested?
What's the point of if, elif, and else? I don't get why using just "if" can work?
Trying to make a nested if statement for a text game? (Python)
You'll have some nicer code with
answer = raw_input("Blah >").lower()That'll get rid of all the capitalization issues. Also, allow for single-word commands. "get up", "stand up", and "stand" should be synonyms, "sit up" and "sit", "look around" and "look". Of course, the second point is only if you want to make the program a little more complex ;-)
It looks like someone else is helping you with the main purpose of this post, I just thought I'd include a couple of my own thoughts.
More on reddit.comHi python people!
I was wondering, generally speaking, if I have many if statements to make... Would nesting them be the clean and practical way to go?
For instance:
if some condition:
....if some condition:
........if some condition:
............if some condition:[do something]
else:
....[do something else]
Edit: i really wasn't able to post my code as intended. Will look into it. Sorry.