Trace tuple unpacking

The program in Listing 1 processes three pairs of integers. In each iteration, unpacking assigns the pair’s first value to first and its second value to second. The program adds first to a running total and calculates the current pair’s difference.

Listing 1: Unpack three integer pairs and update a running total and the current difference.
pairs = [(2, 5), (4, 1), (0, 3)]
running_total = 0
for first, second in pairs:
    running_total += first
    difference = first - second
    # Record the state here.
print(running_total, difference)

Complete Table 1 at the marked checkpoint after each iteration. The first row shows how to record the values. State the final printed output and explain whether unpacking changes the tuples in pairs.

Table 1: State to record after updating the total and difference for each integer pair.
Iteration Current pair first second running_total difference
1 (2, 5) 2 5 2 -3
2 (4, 1)
3 (0, 3)