UnboundLocalError: local variable 'number1' referenced before assignment
<p>I am getting an error in line 2 saying that i have an unboundLocal error. can anyone explain to me how to fix this?</p>

<pre><code> def main():
            number1=getNumber1(number1)
            number2=getNumber2(number2)
            userIntro=''
            printInfo=0.0
            answer=0.0
    #intro module welcomes the user
        def userIntro():
            print('hello welcome to my maximum value calculator')
            print('today we will evaluate two number and display the greater one')
    #this module gets the value of number1
        def getNumber1(number1):
            number1=print(input('Enter the value of number1'))
            return (getNumber1)
    #this module gets the value of number2    
        def getnumber2(number2):
            number2=print(input('Enter the value of number2'))
            return (getNumber2)
    #this module takes the values of number1,number2 and displays the greater value    
        def printInfo(number1,number2,answer):
            answer=max(number1,number2)
            return (answer)
        main()
</code></pre>

<p><code>number1</code> isn't defined until you create it - you can't pass it to another function while defining it. Seems like you need a simpler function that gets the <strong>name</strong> you want to assign to:</p>

<pre><code>def main():
    number1 = getNumber('number1')
    number2 = getNumber('number2')

def getNumber(name):
    return input('Enter the value of ' + name))
</code></pre>

python python-2.7 python-3.x