# Bubble sort algorithm my_list = [5,9,5,8,1,3] def bubble_sort(the_list): orig_list = the_list swapped = True passes = 0 while swapped == True: swapped = False for x in range(len(the_list)-1): if the_list[x] > the_list[x+1]: temp = the_list[x] the_list[x] = the_list[x+1] the_list[x+1] = temp swapped = True passes += 1 print("Pass "+ str(passes) + ": " + str(the_list)) return the_list print("Bubble sorting\n==============") print("Your unsorted list is " + str(my_list)) sorted = bubble_sort(my_list) print("Your sorted list is " + str(sorted))