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.
# Write your code here
n=len(arr)
p=0
ne=0
z=0
for i in range(0,n):
if arr[i]>0:
p+=1
elif arr[i]<0:
ne+=1
elif arr[i]==0:
z+=1
pos = float(p/n)
neg = float(ne/n)
ze = float(z/n)
print("{:.6f}\n{:.6f}\n{:.6f}".format(pos,neg,ze))
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 →