• + 1 comment

    the first code is not only ugly but innefficient. Yout code is simple yes, good performance but it is 0 pythonic and you have two variables with the same value (n and Length). It is not bad but if you are using python you should make use of their tricks. Efficient is wrost in my solution for small inputs.

    Check mine:

    n = int(input())
    arr = [0 if i is 0 else i/abs(i) for i in map(int, input().split())]
    
    for num in map(arr.count, [1, -1, 0]):
        print(round(num/n, 6))
    

    Both have the same performance and both are clear but in mine you are not using excessive code for a simple things.

    Anyways a variation of yours with your logic can be:

    n = int(input())
    values = {'zeros': 0, 'negative': 0, 'positive': 0}
    
    for i in map(int, input().split()):
        values['positive'*(not i) + 'negative'*(i<0) + 'zeros'*(i>0)] += 1
    
    print('\n'.join(map(lambda x: str(round(x/n, 6)) ,values.values())))
    

    In this case is clean and almost more efficient than your solution for small inputs (as map and join presents better performance than a list comprehension and a triple print)