Write a function called sort2()
that will receive a list and return the same list arranged in ascending order (smallest to largest).
Examples:
sort2( [5, 4, 3, 2, 1] )
returns the list [1, 2, 3, 4, 5]
sort2( [3, 1, 4, 1, 5, 9] )
returns the list [1, 1, 3, 4, 5, 9]
Also use the randlist()
function you wrote in a previous assignment to test your function.
You may not use any built-in sort()
function. You may not use a second list.
©2017 Graham Mitchell