Dark theme

"Selection" is the process of making a choice in a program. This usually runs different code depending on the choice. You can think of it as splitting the code temporarily onto different paths based on the choice. Quite often, the paths will come back together fairly quickly.

Add the following code after all your other code:

decision = input("Do you want to enter? [Y,N]: ")
if decision == "N":
    print("Your quest is at an end, goodbye!")
else:
    print("You enter the mines.")
print("The way is lit by candles on the wall.")

Note that three of the lines are indented (pushed across). Traditionally, this is done with four spaces. If you are using Spyder, and you push the TAB key on your keyboard, Spyder will add four spaces.

See if you can get this code to run. Try running your code twice and entering "Y" and "N" to see the difference.

[Home > Part 1 > Next]