题目如下:
======================================================================
知识点:
※ 交换两个数:a,b=b,a
ls = [23,41,32,12,56,76,35,67,89,44]
print(ls)
#冒泡排序:先确定最后一个数,再依次往前
def bub_sort(s_list):
Done = False
while not Done:
Done = True
for i in range(len(s_list)-1):
if s_list[i]>s_list[i+1]:
s_list[i],s_list[i+1]=s_list[i+1],s_list[i]
Done =False
return s_list
bub_sort(ls)
print(ls)