We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def plusMinus(arr):
# Write your code here
positive, negative, zero = 0,0,0
n = len(arr)
for i in arr:
if i > 0:
positive += 1
elif i < 0:
negative += 1
else:
zero += 1
print("{:.6f}".format(positive/n))
print("{:.6f}".format(negative/n))
print("{:.6f}".format(zero/n))
Cookie support is required to access HackerRank
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 →
Python3