Predict the outputExercise 5/7Intermediate30 XP
One pass of bubble sort
Task
Without running the program, write exactly what it prints.
z = [4, 1, 5, 2]
for i in range(len(z) - 1):
if z[i] > z[i + 1]:
z[i], z[i + 1] = z[i + 1], z[i]
print(z)
You need to know
Your answer
Put each printed line on its own line.
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.