1 · Learn and predict
Read this worked example. Predict its output, run it in Python 3, and explain how variables change.
values = [5, 2, 4, 1]
for end in range(len(values)-1, 0, -1):
for i in range(end):
if values[i] > values[i+1]:
values[i], values[i+1] = values[i+1], values[i]
print(values)