Fundamentals
Loops
Control Flow
Basic Language Features
You just need to sort the suggested list. Do this without using the built-in sorting functions.
Example:
arr = [14, 44, 67, 3, 87, 32] ----> [3, 14, 32, 44, 67, 87]
def sort_arr(arr):
if len(arr)<2:
return arr
else:
basic = arr[0]
grater = [i for i in arr[1:] if i > basic]
less = [i for i in arr[1:] if i<= basic]
return sort_arr(less) + [basic] + sort_arr(grater)
test.assert_equals(sort_arr([14, 44, 67, 3, 87, 32]),[3, 14, 32, 44, 67, 87])
test.assert_equals(sort_arr([70, 6, 4, 55, 34, 3, 2, 76, 7, 1, 344, 5, 54]),[1, 2, 3, 4, 5, 6, 7, 34, 54, 55, 70, 76, 344])