So I'm a beginner creating a text-base game, and I am in a situation where the player figures out how to unlock a locked door and are capable of exiting. But I don't want them to exit the door before they unlocked it. Therefore, I though I'd create a separate defined function which I wrote like this:
def exit_():
if decision == "exit":
print("(exit room)")
print("You exit the room.")
room_2()
#level up here
elif decision == "exit prison cell":
print("(exit room)")
print("You exit the room.")
room_2()
# level up here
elif decision == "exit the prison cell":
print("(exit room)")
print("You exit the room.")
room_2()
and then added it together like this:
room_1() and exit_()
After the player inputed their answer correctly to unlock the door. But it doesn't seem to work, is there a way to add two defined functions together or perhaps I have to use another method?