Sorting the numbers without using "sorted" function

I have an assignment that requests creating a program to sort numbers in ascending order.

However, it is restricted to use built-in functions in Python, but only able to use “remove”, “extend” and “append”. It becomes difficult for me since the alternative is not allowed.

Is there anyone knows how to convert the following code?


ListInput = (1, -100, 25, -78, 75.5, 75.4, 11, 2.1)

ListSort = sorted(ListInput)

print(“ListOutput=”, ListSort)

There are many ways to sort numbers. Since this is an assignment, I won’t post an answer. Rather, consider implementing one of many sorting algorithms. Try insertionsort or bubblesort.

Hopefully you are at least permitted to use loops. Otherwise, you may have to resort to recursive functions, which can be a bit involved.

P.S. I believe the sorted() function in Python actually implements the timsort algorithm. :wink: