Certified Entry-Level Python Programmer (PCEP-30-02) — Question 33

A variable defined outside a function:

Answer options

Correct answer: A

Explanation

The correct answer is A because a variable defined outside a function can be read inside the function but requires additional mechanisms, like using the 'global' keyword, to modify it. Option B is incorrect as variables defined outside are not completely inaccessible; they can be read. Option C is also wrong since while the variable can be accessed, it cannot be freely modified without explicit permission.