Computer Science
A local variable having the same name as that of a global variable, hides the global variable in its function.
Python Functions
2 Likes
Answer
True
Reason — Inside a function, you assign a value to a name which is already there in a global scope, Python won't use the global scope variable because it is an assignment statement and assignment statement creates a variable by default in current environment. That means a local variable having the same name as that of a global variable, hides the global variable in its function.
Answered By
3 Likes
Related Questions
A void function also returns a value i.e., None to its caller.
Variables defined inside functions can have global scope.
Assertion. A function is a subprogram.
Reason. A function exists within a program and works within it when called.
Assertion. Non-default arguments cannot follow default arguments in a function call.
Reason. A function call can have different types of arguments.