标签:nbsp int 排序 ext bsp python current 代码 for
li = [33, 2, 10, 1,564,880,8,99,51,3]
# for i in range(len(li) - 1):
# current = li[i]
# next_value = li[i + 1]
# if li[i] > li[i + 1]:
# temp = li[i]
# li[i] = li[i + 1]
# li[i + 1] = temp
# print(li)
#
# for i in range(len(li) - 2):
# if li[i] > li[i + 1]:
# temp = li[i]
# li[i] = li[i + 1]
# li[i + 1] = temp
# print(li)
for j in range(1,len(li)):
for i in range(len(li) - j):
if li[i] > li[i + 1]:
temp = li[i]
li[i] = li[i + 1]
li[i + 1] = temp
print(li)
标签:nbsp int 排序 ext bsp python current 代码 for
原文地址:http://www.cnblogs.com/guishou/p/6930661.html