Python3练习题 006 冒泡排序
import random
a = [random.randint(1,100) for i in range(10)]
def bu(target):
length = len(target)
while length > 0:
length -= 1
cur = 0
while cur < length: #拿到当前元素
if target[cur] < target[cur + 1]:
target[cur], target[cur + 1] = target[cur + 1], target[cur]
cur += 1
return target
print (bu(a))
逆风的方向更适合飞翔,不怕千万人阻挡,只怕自己投降!