Exam-style question
Try this first
In this Python code, which variable is local to the function? count = 10 def display(): message = "Ready" print(message).
- A.count
- B.display
- C.message
- D.print
Model answer
What a good answer should say
- message
Explanation
Why this works
message is defined inside display, so it is a local variable. count is defined outside the function and is therefore global in this example.
Common mistake
No common mistake is linked to this question yet.
