Which of the following is false about global variables in Python?

2023

Which of the following is false about global variables in Python?

  1. A.

    Global immutable variables require global keyword inside function.

  2. B.

    Global mutable variables do not require global keyword inside function.

  3. C.

    Global keyword is a must for the first time of assignment of a global variable.

  4. 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.

Explore the full course: Rssb Senior Computer Instructor