标签:
#!/usr/bin/python # -*- coding: utf-8 -*-
array=[15,1,20,13,8] def bubble_sort(array):
for i in range(len(array),0,-1):
for j in range(len(array)-1):
if array[j] > array[j+1]:
tmp = array[j]
array[j] = array[j+1]
array[j+1] = tmp
print("result: " + str(array))
bubble_sort(array)
print("bubble_sort success!!!")
标签:
原文地址:http://www.cnblogs.com/lgqboke/p/5953221.html