Call a function inside a function? Help to fix : <p>I'm not sure how to fix my code, could someone help!
It prints this --> "NameError: free variable 'info' referenced before assignment in enclosing scope", I don't know how to make info a global variable, i think that is the problem...Someone please help!</p>

<pre><code>import time
import random

admincode = ["26725","79124","18042","17340"]
stulogin = ["NikWad","StanBan","ChrPang","JaiPat","JusChan","AkibSidd","VijSam"]
teachercode = ["KGV"]

def main():
    def accesscontrol():
        global teachercode, stulogin, admincode
        print("Enter: Student,Teacher or Admin")
        option = input("--&gt; ")
        if option == "Student":
            info()
        elif option == "Teacher":
            print("Enter you teacher code(xxx)")
            option = input
            if option == teachercode:
                  print("Access Granted")
                  info()
            else:
                 print("Please input the correct code!")
                 accesscontrol()
        elif option == "Admin":
            print("Enter your admin code(xxxxx)")
            option = input("--&gt; ")
            if option == admincode:
                print("access granted, my master!")
        else:
            accesscontrol()
    accesscontrol()

    def info():
        print("Hello, enter your information below")
        usname = input("Username: ")
        pwname = input("Password: ")
        done = False
        while not done:
            print("Is this the information correct?[Y/N]")
            option = input("--&gt; ")
            if option == "Y":
                print("Information saved")
                print("Username :",usname,"\nPassword:",pwname)
                done = True
            else:
                main()
        return info()
    info()

main()
</code></pre>
