def bubble_sort(lists) : exchange = False; length = len(lists); for i in range(length) : j = length - 1 ; while j >= i : if lists[j] < lists[j - 1 ] : tmp = lists[j]; lists[j] = lists[j - 1 ]; lists[j - 1 ] = tmp; exchange = True; j -= 1 ; if False == exchange : break ; return lists;