logo

Question detail

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

Try the question, check the answer, then read the explanation to understand the curriculum point.

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

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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.