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):
lis1=[x for x in arr if x>0]
lis2=[x for x in arr if x<0]
lis3=[x for x in arr if x==0]
print(f'{round(len(lis1)/len(arr),6)}\n{round(len(lis2)/len(arr),6)}\n{round(len(lis3)/len(arr),6)}')
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 →
def plusMinus(arr): lis1=[x for x in arr if x>0] lis2=[x for x in arr if x<0] lis3=[x for x in arr if x==0] print(f'{round(len(lis1)/len(arr),6)}\n{round(len(lis2)/len(arr),6)}\n{round(len(lis3)/len(arr),6)}')