Predict the pauses at a loop breakpoint

A student runs the program below in their IDE's debug mode. The only breakpoint is on the line total = total + i, and each time the program pauses the student reads the Variables pane, then presses Resume (Continue) to run on to the next breakpoint hit.


Python
total = 0
for i in range(1, 7):
    if i % 2 == 0:
        total = total + i
print(total)


Complete the table with whole numbers: the values of i and total shown in the Variables pane at each pause, and their values when the print line runs after the loop.

Momentitotal
Pause 1
Pause 2
Pause 3
When the print line runs

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Development Environments Questions: