• + 0 comments

    For Python3 Platform

    I wrote the code from scratch just to get more practice

    def plusMinus(arr):
        positive = len([i for i in arr if i > 0])
        negative = len([i for i in arr if i < 0])
        zero = len([i for i in arr if i == 0])
        
        print(f"{positive/len(arr):.6f}")
        print(f"{negative/len(arr):.6f}")
        print(f"{zero/len(arr):.6f}")
    
    n = int(input())
    arr = list(map(int, input().split()))
    
    plusMinus(arr)