What is the difference between local variable and global variable in python?
Answers
Answered by
9
Answer:
Local variable is declared inside a function whereas Global variable is declared outside the function. Local variables are created when the function has started execution and is lost when the function terminates, on the other hand, Global variable is created as execution starts and is lost when the program ends.
Explanation:
I hope it's help to you ✌
Answered by
9
Answer:
A global variable is a variable that is accessible globally. A local variable is one that is only accessible to the current scope, such as temporary variables used in a single function definition.
Explanation:
Hope its helpful.
Similar questions