0

So I am very new to python. The text based game I'm making incorperates multiple choices and routes to choose from. I'd imagine I use the very basic ways of executing things, that's because I primarily use if/else/elif statements. The following is the problem I occur when presented the second question in the game from either of the two main routes.

This is the full problem

I assume this is a simple problem but I truly do not know. I used all if statements for the choices. The start of each choices starts like the following.

This is showing example of code that I've used in my adventure game

I'd prefer a thorough explanation so that I may learn alongside fixing this error. To whoever may answer to my problem is greatly appreciated. Thank you.

1 Answers1

0

The issue is that you are using a print statement instead of an input statement for text that you want to enter. It gives you "yellow" text because you are entering commands in powershell and not in your program as it had already ended.

The program ended because it had nothing more to do. The variable answer didn't match any of the later if statements and thus moved to the end and terminated.

Instead of:

print("There is atleast a dozen of these nasty creatures. (Run or fight)")

Do:

answer = input("There is atleast a dozen of these nasty creatures. (Run or fight)")
hypadr1v3
  • 543
  • 4
  • 26