用python写个冒泡排序
以a = [4, 3, 2, 1]为例,进行冒泡排序
a = [1, 3, 10, 9, 21, 35, 4, 6] for i in range(len(a) - 1): for j in range(len(a) - 1 - i): if a[j] > a[j+1]: a[j], a[j+1] = a[j+1], a[j] print(a)