You are viewing a single comment's thread. Return to all comments →
This is my code in Python 3.
def plusMinus(arr): n = len(arr) pos = [i for i in arr if i > 0] neg = [i for i in arr if i < 0] zero = [i for i in arr if i == 0] print(len(pos) / n) print(len(neg) / n) print(len(zero) / n) if __name__ == '__main__': n = int(input().strip()) arr = list(map(int, input().rstrip().split())) plusMinus(arr)
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
This is my code in Python 3.