• Absolute sorting - precondition error

 

I would like to give some feedback about ...

From: https://py.checkio.org/mission/absolute-sorting/solve/

The following precondition: 0 < len(array) < 100

Should be fixed to: 0 < len(array) <= 100

Cheers!

My code:

def checkio(numbers_array):

    if len(set(abs(x) for x in numbers_array)) == len(numbers_array) and 0 < len(numbers_array) <= 100 and all(isinstance(x, int) for x in numbers_array) and all(-100 < x < 100 for x in numbers_array):

        numbers_array = sorted(numbers_array, key = lambda number: abs(number))
        return numbers_array

    else:
        print ("You f...ed up!")


#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
    def check_it(array):
        if not isinstance(array, (list, tuple)):
            raise TypeError("The result should be a list or tuple.")
        return list(array)

    assert check_it(checkio((-20, -5, 10, 15))) == [-5, 10, 15, -20], "Example"  # or (-5, 10, 15, -20)
    assert check_it(checkio((1, 2, 3, 0))) == [0, 1, 2, 3], "Positive numbers"
    assert check_it(checkio((-1, -2, -3, 0))) == [0, -1, -2, -3], "Negative numbers"