# 冒泡排序
nums = [1,3,9,4,2,6,8,7,0]
length = len(nums)
for i in range(length):
for j in range(length - 1 - i):
if nums[j] > nums[j+1]:
nums[j],nums[j+1] = nums[j+1],nums[j]
print(nums)
print(nums)
待排序列表:[1,3,9,4,2,6,8,7,0]
排序后结果:[0, 1, 2, 3, 4, 6, 7, 8, 9]