You are viewing a single comment's thread. Return to all comments →
in Python, we can leverage list comprehension for this problem
n = len(arr) pos = len([i for i in arr if i > 0]) / n neg = len([i for i in arr if i < 0]) / n zer = len([i for i in arr if i == 0]) / n print("{:.6f}\n{:.6f}\n{:.6f}".format(pos, neg, zer))
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 →
in Python, we can leverage list comprehension for this problem