This blog is about global and local variables in python Local variables can be accessed only inside the function where they are declared, but global variables can be accessed throughout the program body by all functions. Let’s take an example of code : def my_func():
var = 10
print("Value inside function:",var) This is creating the function. The…