def bubble_sort( the_seq ): '''Sinks the largest item to the bottom in each round''' n = len( the_seq ) for i in range( n - 1, 0, -1 ) : for j in range( i ) : if the_seq[j] > the_seq[j + 1] : # swap the two items tmp = the_seq[j] the_seq[j] = the_seq[j + 1] the_seq[j + 1] = tmp