Plus Minus

  • + 0 comments
    def plusMinus(arr):
        # Write your code here
        total = len(arr)
    
        positives = len([v for v in arr if v > 0]) / total
        negatives = len([v for v in arr if v < 0]) / total
        zeros = len([v for v in arr if v == 0]) / total
        
        def print_r(val: float):
            print(f"{round(val, 6)}")
        
        print_r(positives)
        print_r(negatives)
        print_r(zeros)