1 #!/usr/bin/env python 2 """a1 = 123 3 a2 = 456 4 temp = a1 5 a1 = a2 6 a2 = temp 7 print(a1, a2) 8 """ 9 # 冒泡排序10 li = [11,22,33,7,342,432,2,5,14,15,31,55,23,5236]11 m = 112 for t in range(len(li)) :13 print(t)14 for i in range(len(li) - m) :15 16 temp = li[i]17 if li[i] > li[i + 1] :18 li[i] = li[i + 1]19 li[i + 1] = temp20 m+=121 print(li)