1mylist = [12, 5, 13, 8, 9, 65]
2
3def bubble(badList):
4 length = len(badList) - 1
5 unsorted = True
6
7 while unsorted:
8 for element in range(0,length):
9 unsorted = False
10 if badList[element] > badList[element + 1]:
11 hold = badList[element + 1]
12 badList[element + 1] = badList[element]
13 badList[element] = hold
14 print badList
15 else:
16 unsorted = True
17
18print bubble(mylist)
19