def funcname(parameter_list):
num_len = len(parameter_list)
for j in range(num_len):
for i in range(num_len - 1 - j):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
if __name__ == '__main__':
a = [1, 2, 22, 4, 5, 6, 7, 8, 9]
funcname(a)
print(a)
Python 冒泡排序
最新推荐文章于 2024-11-11 21:19:25 发布