Which of the following is false about global variables in Python?
2023
Which of the following is false about global variables in Python?
- A.
Global immutable variables require global keyword inside function.
- B.
Global mutable variables do not require global keyword inside function.
- C.
Global keyword is a must for the first time of assignment of a global variable.
- D.
Global variables can be accessed anywhere in the program.
Attempted by 1497 students.
Show answer & explanation
Correct answer: C
The global keyword is required whenever a global variable is assigned inside a function, not just for the first time.