You are viewing a single comment's thread. Return to all comments →
def plusMinus(arr): pcount = 0 ncount = 0 zcount = 0 for i in range(n): if arr[i] > 0: pcount = pcount+1 elif arr[i] < 0: ncount = ncount+1 elif arr[i] == 0: zcount = zcount+1 print(f"{pcount/n:.6f}") print(f"{ncount/n:.6f}")
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 →
FOR PYTHON 3
def plusMinus(arr): pcount = 0 ncount = 0 zcount = 0 for i in range(n): if arr[i] > 0: pcount = pcount+1 elif arr[i] < 0: ncount = ncount+1 elif arr[i] == 0: zcount = zcount+1 print(f"{pcount/n:.6f}") print(f"{ncount/n:.6f}")
print(f"{zcount/n:.6f}")