I am new to python. I searched on Google but didn't find an appropriate answer. What I am not understanding is, in the first program we can call bar function before its declared but in another program we can't call it before?
def foo():
bar()
def bar():
print("hello")
foo()
Output:
hello
Another code:
bar()
def bar():
print("hello")
NameError: name 'bar' is not defined