冒泡排序Python实现
程序员文章站
2022-03-24 15:46:13
...
# 冒泡排序
x =[1,2,6,0.3,2,0.5,-1,2.4]
n =len(x)
for i in range(n):
for j in range(i):
if x[j] > x[i]:
x[i],x[j] =x[j],x[i]
print(x)