Every step is remembered: the run can go back, and the timeline slider goes to any step, also after the end.
a = [7, 3, 9, 1, 5]
for i in range(1, len(a)):
key = a[i]
j = i - 1
while j >= 0 and a[j] > key:
a[j + 1] = a[j]
j -= 1
a[j + 1] = key
print(a)
Student
- Click Step several times, then Step back: the variables are as they were.
- After the end drag the slider Position in the run: watch how
keymoves left through the list. - Step again with the same input starts over with the same input.
Teacher
- Use it to find the step where a value goes wrong: go forward to the wrong output, then back.