Exam-style question
Try this first
In this Python 3 code, which variable is local to calculate_total? def calculate_total(): total = 0 return total.
- A.total
- B.calculate_total
- C.return
- D.None
Model answer
What a good answer should say
- total
Explanation
Why this works
total is declared inside calculate_total, so it is accessible only within that subroutine and is a local variable.
Common mistake
No common mistake is linked to this question yet.
