P46PythonBeginnerDiagnose5 min

Trace a List Mutation That Duplicated Revenue Labels

Trace a small function to find a shared-list mutation that duplicates a revenue label.

#diagnose#lists#mutation

Scenario

A reporting helper receives labels = ['Retail', 'Wholesale'] and appends 'Total' before returning it. A second report unexpectedly starts with an existing Total label.

Problem statement

Identify the failure and explain why downstream totals changed.

Your Task

  1. Trace the list across two calls.
  2. Identify the shared-state mutation.
  3. Give a safe correction.

Related Concepts

ListsMutationFunction contracts

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.