Exam-style question
Try this first
Which statement about a local variable is correct?.
- A.It is automatically available in every function.
- B.It is defined within a limited part of the program and is not generally available outside that part.
- C.It must have the same name as a global variable.
- D.It can only be used in programs written in Python.
Model answer
What a good answer should say
- It is defined within a limited part of the program and is not generally available outside that part.
Explanation
Why this works
A local variable has a restricted scope. Its use is limited to the local section in which it is defined, such as a function.
Common mistake
No common mistake is linked to this question yet.
