Life is short, you need Python

The bubble up procedure by python

 

array = [1,6,7,2,9,4]
for i in range(len(array)-1,1,-1):
for j in range(0,i):
if array[j] > array[j+1]:
array[j],array[j
+1] = array[j+1],array[j]
print array

Wow, Python is so powerful, Let start to enjoy it now!

posted @ 2010-06-13 09:18  runfox545  阅读(212)  评论(0编辑  收藏  举报
白月黑羽 Python教程 白月黑羽Python