Plus Minus

  • + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    #

    Complete the 'plusMinus' function below.

    #

    The function accepts INTEGER_ARRAY arr as parameter.

    #

    def plusMinus(arr): # Write your code here n=len(arr) positive=sum(1 for x in arr if x>0) negative=sum(1 for x in arr if x<0) zero=sum(1 for x in arr if x==0) print(f"{positive / n:.6f}") print(f"{negative / n:.6f}") print(f"{zero / n:.6f}")

    if name == 'main': n = int(input().strip())

    arr = list(map(int, input().rstrip().split()))
    
    plusMinus(arr)