python - How to pass local variables from one function into another? -
i trying make text-based game having troubles passing variables 1 function another. figured out how modify variable inside function , return new values overwrite original. what need how room1() , room2() variables something1(x) , something2(y) , main() unlock if statement. should have 2 different or 1 function something1(x) , something2(y) ? this general sample code problem i'm having: def something1(x): x += 0 return x def something2(y): y += 0 return y def main(): print("1. try open door") print("2. go room1") print("3. go room2") choice = int(input("enter selection: ") if choice == "1": # trying if statement work variables # don't know function or parameters pass in order work if x == 3 , y == 2: print("you're free") else: print("you're not free") elif choice == "2": ...