figure bubble sortthe first pass a_list[jtemp will exchange the ith and th items in the list without the temporary storageone of the values would be overwritten in pythonit is possible to perform simultaneous assignment the statement ab ba will result in two assignment statements being done at the same time (see figure using simultaneous assignmentthe exchange operation can be done in one statement lines - in the bubble_sort function perform the exchange of the and ( + )th items using the three-step procedure described earlier note that we could also have used the simultaneous assignment to swap the items to analyze the bubble sortwe should note that regardless of how the items are arranged in the initial listn passes will be made to sort list of size table shows the number of comparisons for each pass the total number of comparisons is the sum of the first integers recall that the sum of the first integers is the sum of the first integers is nwhich is this is still ( comparisons in the best caseif the list is already orderedno exchanges will be made howeverin the worst caseevery comparison will cause an exchange on averagewe exchange half of the time bubble sort is often considered the most inefficient sorting method since it must exchange items before the final location is known these "wastedexchange operations are very costly howeverbecause the bubble sort makes passes through the entire unsorted portion of the list sorting