#!usr/bin/evn python #filename:bubble.py def bubb(L): print L j=0 a=True while a: if j<7: for i in range(len(L)-1-j): if L[i]>L[i+1]: L[i],L[i+1]=L[i+1],L[i] j=j+1 else: a=False print L bubb([1,34,2,4,56,88,33,8,1])
#!usr/bin/evn python #filename:bubble.py def bubb(L): print L j=0 a=True while a: if j<7: for i in range(len(L)-1-j): if L[i]>L[i+1]: L[i],L[i+1]=L[i+1],L[i] j=j+1 else: a=False print L bubb([1,34,2,4,56,88,33,8,1])