def bubble(a): n = len(a) for i in range(1,n): for j in range(0,n-i): if a[j] > a[j+1]: a[j],a[j+1] = a[j+1],a[j] if __name__ == '__main__': lst = [6,5,4,3,2,1] bubble(lst) print(lst)