0

Brand new to programming so please forgive my ignorance.

I want the script to begin with POWER = False, then trigger an event that makes it True for the rest of the script. The way I have it here doesn't save the POWER variable.

power = False
scuba = False

def computer_room():
    if not power:
        print("yadayadayada.")
        time.sleep(1)
        terminal_out()

    elif power:
        print("yadayadayada.")
        time.sleep(1)
        terminal_in()

def terminal_out():
    print("yadayadayada.")
    choice = input("> ")

if "password" in choice.lower():
    print("What is the password?")
    choice2 = input("> ")

    if choice2 == "f1xh3rup":
        power = True
        terminal_in()
  • 3
    Possible duplicate of [Using global variables in a function](https://stackoverflow.com/questions/423379/using-global-variables-in-a-function) – awesoon Oct 15 '18 at 11:19

1 Answers1

1

Define power as global before you use it in function global power

kaan bobac
  • 729
  • 4
  • 8