+ 1

Well this one is confusing ..like hello() was already defined above ..but why error?

https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2285/

18th Jul 2018, 8:28 AM
Deesha Devi Raghu
Deesha Devi Raghu - avatar
3 ответов
+ 4
Daya The reason for the error, was that the hello() function was called before it's definition. It was like trying to use a variable you hadn't created.
18th Jul 2018, 8:32 AM
Dlite
Dlite - avatar
+ 3
You can't call a function before it is defined. Something like this happens. It goes to the first line which says hello(), it goes to its memory to run the function hello, but as there is no hello function already defined in memory, it gives you an error and stops. Remember, Python is an interpreted language and runs top to bottom.
18th Jul 2018, 8:50 AM
Satyam
+ 2
for create a function def fun() print('hi') for use a function when not return any value. fun() if function return any value then use it like. print(fun())
18th Jul 2018, 11:32 AM
Maninder $ingh
Maninder $ingh - avatar