codeflash/code_to_optimize/bubble_sort_3.py
2023-12-29 18:37:49 -08:00

8 lines
236 B
Python

def sorter(arr):
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j + 1]:
temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
return arr