Python | Namespaces and Scope Quiz | Question 4

Last Updated :
Discuss
Comments

Which of the following statements is true regarding the scope of a variable in Python?

Local variables can be accessed globally.

Global variables can be accessed only within the function they are defined.

Local variables override global variables with the same name.

Global variables always take precedence over local variables.

Share your thoughts in the comments