Code
Code
This function sorts a list of numbers in ascending order using the bubble sort
algorithm.
Args:
list_to_sort: A list of numbers to be sorted.
Returns:
A new list with the numbers sorted in ascending order.
"""
# Create a copy of the list to avoid modifying the original
sorted_list = list_to_sort.copy()
n = len(sorted_list)
# Example usage
my_list = [1, 9, 5, 2, 1, 8, 6, 6, 3, 4, 10, 7]
sorted_list = sort_list(my_list)
print(sorted_list) # Output: [1, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10]