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.
- Plus Minus
- Discussions
Plus Minus
Plus Minus
Sort by
recency
|
289 Discussions
|
Please Login in order to post a comment
1 (0)n>
1 (0)n>
aviator Signals
!/bin/python3
import math import os import random import re import sys
#
Complete the 'plusMinus' function below.
#
The function accepts INTEGER_ARRAY arr as parameter.
#
def plusMinus(arr): # Write your code here n=len(arr) positive=sum(1 for x in arr if x>0) negative=sum(1 for x in arr if x<0) zero=sum(1 for x in arr if x==0) print(f"{positive / n:.6f}") print(f"{negative / n:.6f}") print(f"{zero / n:.6f}")
if name == 'main': n = int(input().strip())