Question
The code below should compute the sum of [3, 7, 2, 9, 5] but returns the wrong answer:
numbers = [3, 7, 2, 9, 5]
total = 1
for num in numbers:
total += num
print("Total:", total)
(a) Add print statements inside the loop to trace num and total after each step.
(b) Identify the bug.
(c) Fix the code and verify the correct answer is 26.