# Bubble Sort Demonstration code # # Jay Summet # CS 1301 # Released to the public domain 10/15/2008 aList = [4,5,6,-3,100,7,2,-10] def swapElements(aList): i = 0 while( i < len(aList) - 1 ): if (aList[i] > aList[i+1]): temp = aList[i] aList[i] = aList[i+1] aList[i+1] = temp i = i+1 def bubbleSort(aList): for num in range(len(aList) - 1 ): swapElements(aList) print(aList) print aList bubbleSort(aList) print aList