I'm been having a lot of trouble properly using functions in python. Im a beginner so I'm creating this kinda maze like game, and want to use functions so that a user can return to previous locations if they choose to. The problem is that all the code after the "def sec2():" does not run, and it totally skips over this block of code. So if the user were to run the program and choose left, the program finishes with "Ah, nevermind, remember those numbers," never prompting the user with anything or printing anything from sec2. I believe my problems could be occurring with indentation. If anyone has any idea as to why the code under my functions isn't executing please let me know! Many thanks!
print ("********")
print ("Hey there soldier. This is General Chris.")
print ("I understand you are in quite the situation!")
print ("Just 4 hours ago, your patrol was ambushed by ISIS...You may not rememeber much after being knocked unconscious!")
name = input('Whats your name, soldier?')
print ("********")
print ("Alright, here's the deal",name)
print ("You are now being held hostage in an encampment near Soran, Iraq.")
print ("Unfortunately for you, our hackers have recieved intel that your captors plan on executing you in just two hours.")
print ("You dont have long to make your escape! Get moving fast!")
def sec1():
print ("********")
print ("You have two doors in front of you. Do you choose the door on the left or right?")
room1 = input('Type L or R and hit Enter.')
if room1 == "L":
print ("********")
print ("Good choice",name)
print ("Whats this? A slip of paper says '8642' on it...Could it mean something?")
print ("Ah, nevermind! Remember those numbers!")
def sec2():
print ("********")
print ("Now you have a choice between crawling into the cieling, or using the door!")
room2 = input('Type C for cieling or D for door, and hit Enter!')
if room2 == "C":
print ("********")
print ("Sure is dark up here in the ducts!")
print ("Stay quiet, and move very slowly.")
def ductoptionroom():
print ("Do you want to continue into the ducts or retreat?")
ductoption = input('Type C or R and hit Enter!')
if ductoption == "C":
print ("You are continuing into the ducts!")
elif ductoption == "R":
sec2()
else:
print ("Focus on the mission!")
elif room2 == "D":
print ("********")
print ("You slowly turn the door knob and see a guard standing there...He doesnt notice you!")
print ("Look, theres a piece of rope on the ground! You could use this to strangle the guard!")
def guardkillroom():
print ("Do you want to try and kill the guard so you can continue on your escape?")
guardkill = input ('Type K for kill or R for retreat and hit Enter!')
if guardkill == "K":
print ("********")
print ("You sneak behind the unsuspecting guard and quickly pull the rope over his neck!")
print ("You've strangled the guard! Now you can continue on your mission!")
elif guardkill == "R":
guardkillroom()
else:
print ("We dont have all day!")
guardkillroom()
else:
print ("Focus soldier!")
room2()
elif room1 == "R":
print ("********")
print ("Uh oh. Two guards are in this room. This seems dangerous.")
print ("Do you want to retreat or coninue?")
roomr = input('Type R or C and hit enter.')
if roomr == "R":
print ("********")
print ("Good choice!")
sec1()
elif roomr == "C":
print ("********")
print ("You continue and are spotted by a guard.")
print ("***MIISSION FAILED***")
def gameover1():
print ("Do you want to retry?")
retry1 = input("Type Y or N and hit enter!")
if retry1 == "Y":
sec1()
elif retry1 == "N":
print ("********")
print ("Thanks for playing!")
else:
gameover1()
sec1()