Files
30-seconds-of-code/test/bubble_sort/bubble_sort.py
2018-04-14 10:54:46 +00:00

7 lines
237 B
Python

def bubble_sort(lst):
for passnum in range(len(lst) - 1, 0, -1):
for i in range(passnum):
if lst[i] > lst[i + 1]:
temp = lst[i]
lst[i] = lst[i + 1]
lst[i + 1] = temp