I defined one function, and in the function or another function I assign the same-name value by call the same-name function. I get this error
UnboundLocalError: local variable 'demo01' referenced before assignment
The error occurs here
def demo01():
return 5
def demo02():
demo01=demo01()
demo02()
UnboundLocalError: local variable 'demo01' referenced before assignment
But these snippets are fine
def demo01():
return 5
def demo02():
demo01=demo01()
demo01 = demo01()
def demo01():
return 5
def demo02():
demo02=demo01()
demo02()