Plus Minus

  • + 0 comments
    def plusMinus(arr):
        positives, negatives, zeros = 0, 0, 0
        total = len(arr)
        for i in arr:
            if i < 0:
                negatives += 1
            elif i == 0:
                zeros += 1
            else:
                positives += 1
        print(f"{(positives/total):.6f}")
        print(f"{(negatives/total):.6f}")
        print(f"{(zeros/total):.6f}")