Reputation: 5
I have to whip up a text editor (spin off of Adventures into Zork) game for my summative project.
This is my decision for the first zone.
second = True
while second:
firstLog = input(">")
This is where I am having problems, as when I input "Inside" or "In" the script gets terminated.
if firstLog = "Inside" or "In" or "Space Ship":
print("There is a small " color.Bold + "console " + color.End + "in front of you.")
print("You can " + color.Bold + "input " + color.End + "or" + color.Bold + "Exit" + color.End)
second = False
Also if I enter anything else it terminates as well instead of printing this and restarting the loop.
else:
"Not valid."
second = True
Upvotes: 0
Views: 93
Reputation: 167
Few things. The final else you are missing a print statement.
else:
print("Not valid.")
The if firstLog should state the variable comparison again.
if firstLog == "Inside" or firstLog == "In" or firstLog == "Space Ship":
better yet, you could do something like this:
if firstLog.lower() in ["inside", "in", "space ship"]:
Upvotes: 4