标签:__name__ span return main bubble style col 排序 冒泡
def bubbleSort(arr,length):
for j in range(length):
for i in range(length-1):
if arr[i] > arr[i+1]:
arr[i],arr[i+1] = arr[i+1],arr[i]
return arr
if __name__ == "__main__":
li=[1, 3, 10, 9, 21, 35, 4, 6]
s=len(li)
print(bubbleSort(li,s))
标签:__name__ span return main bubble style col 排序 冒泡
原文地址:https://www.cnblogs.com/beiyue/p/11211203.html