Skip to content

Latest commit

 

History

History
11 lines (10 loc) · 304 Bytes

bubble sort in python.md

File metadata and controls

11 lines (10 loc) · 304 Bytes

def bubbleSort(alist): for passnum in range(len(alist)-1,0,-1): for i in range(passnum): if alist[i]>alist[i+1]: temp = alist[i] alist[i] = alist[i+1] alist[i+1] = temp

alist = [10,2,32,12,323,11,1,7] bubbleSort(alist) print(alist)