I am trying to do one of the exercises from learn python the hard way and am stuck on something. I created a function and in case one of the statements is fulfilled I would like to put that in another function. This is the outline of how I'm trying to do it:
def room_1():
print "Room 1"
button_push = False
while True:
next = raw_input("> ")
if next == "1":
print "You hear a click but nothing seems to happen."
button_push = True
elif next == "2":
print "You enter room 2"
room_2()
def room_2():
print "Room 2"
while True:
next =raw_input("> ")
if next == "1" and button_push:
print "You can enter Room 3"
room_3()
If button_push is fulfilled then I would like to see that in room_2. Could anyone please help me with that?