<filename>HackerRank/plus_minus.py
""" Plus Minus """


def plusMinus(arr):
    positive = 0
    negative = 0
    neutral = 0
    size = len(arr)

    for num in arr:
        if num > 0:
            positive += 1
        elif num < 0:
            negative += 1
        else:
            neutral += 1

    return positive/size, negative/size, neutral/size

if __name__ == "__main__":
    res = plusMinus([-4, 3, -9, 0, 4, 1])
    print(res)

<filename>HackerRank/plus_minus.py
""" Plus Minus """


def plusMinus(arr):
    positive = 0
    negative = 0
    neutral = 0
    size = len(arr)

    for num in arr:
        if num > 0:
            positive += 1
        elif num < 0:
            negative += 1
        else:
            neutral += 1

    return positive/size, negative/size, neutral/size

if __name__ == "__main__":
    res = plusMinus([-4, 3, -9, 0, 4, 1])
    print(res)

Plus Minus