local variable 'xxx' referenced before assignment

def t1():
    print val       
    val = 1    
         
a=3
def t2():
    print "ggg"
    print a
    a=4

def t3(vv):
    if vv:
        a=4
    else:
        print "haha"
    return a

t1()
t2()
t3(0)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325252790&siteId=291194637