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
Answer and explanation
Concise answer
total
Why this is correct
total is declared inside calculate_total, so it is accessible only within that subroutine and is a local variable.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
