May-22-2017, 02:40 PM
You really need a loop that keeps track of the state of the game. The format you are using is far too restrictive. For example, you can't open the glovebox until you try to open the car and fail. I would strongly suggest reading the text adventure tutorial linked to in my signature.
Also, the standard way in Python for case insensitive text matching is to use the lower method of the input string, which makes it all lowercase:
Also, the standard way in Python for case insensitive text matching is to use the lower method of the input string, which makes it all lowercase:
if userInput.lower() == 'leave car': # do stuffThe above code covers all three cases you have in your code. This allows to not repeat code. Repeating code is a bad idea, it is an invitation for bugs and inconsistencies.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures