why this code doesn't work at all?:
l3 = [1, 7, 10, 16, 5, 6, 13, 20]
for i in range(len(l3)):
l3[i], l3[l3.index(min(l3[i:]), i)] = l3[l3.index(min(l3[i:]), i)], l3[i]
print(l3)
However when we change the order - it works well:
l3 = [1, 7, 10, 16, 5, 6, 13, 20]
for i in range(len(l3)):
l3[l3.index(min(l3[i:]), i)], l3[i] = l3[i], l3[l3.index(min(l3[i:]), i)]
print(l3)