CBSE Class 12 Computer Science Question 93 of 101

Functions — Question 5

Back to all questions
5
Question

Question 5

A local variable having the same name as that of a global variable hides the global variable in its function.

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.