# 冒泡排序,lst = [5,1,7,2,6,4,5,6]count = 0while count < len(lst): # 控制次数 i = 0 while i < len(lst) - 1: if lst[i] > lst[i + 1]: lst[i], lst[i + 1] = lst[i + 1], lst[i] i = i + 1 count = count + 1print(lst)