Function not Running inside an "if" statement Python 3 -
i'm attempting write escape room game in python.
when run code pycharm process ends "process finished exit code 0."
is there wrong in defining of functions?
here code (its bit lengthy):
choice = none def main_choice(): print("1. examine door") print("2. examine painting") print("3. examine desk") print("4. examine bookshelf") choice == input("make choice: ") def door(): print("1. try open door") print("2. take closer look") print("3. go were.") door_choice = input("what now? ") if door_choice == "1": print("the door heavy open bare hands.") door() if door_choice == "2": print("there red light above door, seems have no purpose.") print("you notice 9 key keypad next door. looks accept 3 digit code.") keypad_code = input("would enter code?").lower if keypad_code == " yes": guess = input("enter code: ") if guess == complete_key: print("the light turns green , hear sound of mechanical lock unlocking. door opens.") print("you win!!!") if guess != complete_key: print("wrong code.") main_choice() if door_choice == "3": main_choice() else: print("you didn't answer") main_choice() if choice == "1": print("you walk door") door()
i think might last "if" statement, i'm not positive.
you need change choice == input("make choice: ")
choice = input("make choice: ")
in main_choice
function:
def main_choice(): print("1. examine door") print("2. examine painting") print("3. examine desk") print("4. examine bookshelf") choice = input("make choice: ")
otherwise choice
variable still none
, if choice == "1":
false.
Comments
Post a Comment