A program stores five numbers and sums only the odd values, then prints the result.
1 numbers = [1, 2, 3, 4, 5] 2 total_odd = 0 3 for n in numbers: 4 if n % 2 != 0: total_odd += n 5 print(total_odd)
Trace the variables n and total_odd on each iteration for line 4:
| Iteration | n | total_odd (after line 4) |
|---|---|---|
| 1 | 1 | |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 |