Write briefly the scope and life time of variables in
functions.
Answers
Answered by
0
The scope of a variable is the part of the program within which the variable can be used. So, the scope describes the visibility of an identifier within the program. The lifetime of a variable or function is the time duration for which memory is allocated to store it, and when that memory is released.
Answered by
2
The scope of a variable is the part of a program where the variable is known. Parameters and variables defined inside a function are not visible from outside. Hence, they have a local scope. 2. The lifetime of a variable is the period throughout which the variable exits in the memory of your Python program
Similar questions