You are viewing a single comment's thread. Return to all comments →
def plusMinus(arr): pos_num = 0 neg_num = 0 zeroes = 0 for i in arr:
if i < 0: neg_num+=1 elif i > 0: pos_num+=1 # print(i) elif i == 0: zeroes+=1 else: return None value1 =pos_num/len(arr) value2 =neg_num/len(arr) value3 =zeroes/len(arr) print(f"{value1:.6f}") print(f"{value2:.6f}") print(f"{value3:.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 →
def plusMinus(arr): pos_num = 0 neg_num = 0 zeroes = 0 for i in arr: