Sort an array of integers - Python:
def sort_array(arr):
"""
Sort an array of integers.
Parameters
----------
arr : list
The array to sort.
Returns
-------
list
The sorted array.
"""
#sort the array and return it
return sorted(arr)
#example
result = sort_array([1, 2, 3, 4, 5])
#output
print(result) #[1, 2, 3, 4, 5]
Top comments (0)