def BubbleSort(lst): for passesLeft in range(len(lst)-1, 0, -1): for i in range(passesLeft): if lst[i] > lst[i + 1]: lst[i], lst[i + 1] = lst[i + 1], lst[i] return lst print BubbleSort([7,9,1,2,3,6,4,5,8,0]);