python十位正整数的冒泡法排序
时间: 2023-10-21 13:33:32 浏览: 62
可以提供代码如下:
numbers = [9, 3, 7, 1, 8, 2, 6, 5, 0, 4]
n = len(numbers)
for i in range(n):
for j in range(0, n-i-1):
if numbers[j] > numbers[j+1]:
numbers[j], numbers[j+1] = numbers[j+1], numbers[j]
print("排序后的列表为:")
print(numbers)
阅读全文