def bubble_sort(lst): for i in range(len(lst) - 1): for j in range(len(lst) - 1 - i): if lst[j] > lst[j + 1]: lst[j], lst[j + 1] = lst[j + 1], lst[j] return lst
The function bubble_sort takes in a list as an argument. The function will go through the list and compare the value of each element to the value of the element next to it. If the value of the first element is bigger than the value of the second element, the values of the two elements are swapped. The function will continue to go through the list, comparing the value of each element to the value of the element next to it and swapping the two elements if necessary until the list is sorted in ascending order.