Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short solution in Clear category for Absolute Sorting by PistoleroAlan
checkio=lambda values:sorted(values,key=abs)
print("Example:")
print(checkio([-20, -5, 10, 15]))
# These "asserts" are used for self-checking
assert checkio([-20, -5, 10, 15]) == [-5, 10, 15, -20]
assert checkio([1, 2, 3, 0]) == [0, 1, 2, 3]
assert checkio([-1, -2, -3, 0]) == [0, -1, -2, -3]
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 1, 2023