logo

AQA A-Level Computer Science practice

In this Python 3 code, which variable is local to calculate_total? def calculate_total(): total = 0 return total

Try the question first, then check the answer and practise the same topic again.

At a glance

MCQ

Type

practice

Style

Topic

Programming

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.

  1. A.total
  2. B.calculate_total
  3. C.return
  4. 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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions