Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Mr. Obvious solution in Clear category for Absolute Sorting by deciver5
def checkio(values: list) -> list:
return (sorted (values,key = lambda x : abs(x)))
if __name__ == '__main__':
# These "asserts" are used for self-checking and not for an auto-testing
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("Coding complete? Click 'Check' to earn cool rewards!")
Aug. 4, 2022
Comments: