def f(t): n = len(t) for i in range(n-1): if t[i] > t[i+1]: t[i],t[i+1] = t[i+1],t[i] L = [4, 8, -7, 0, 1] f(L)