title: Integer Positive Value Positive Negative Value Array 1
signature: def integer_positive_value_positive_negative_value_array_1(arr, n):
source_py: def integer_positive_value_positive_negative_value_array_1(arr, n):
      neg = 0
      pos = 0
      sum = 0
      for i in range(0, n):
          sum += arr[i]
          if (arr[i] < 0):
              neg += 1
          else:
              pos += 1
      return (sum / abs((neg - pos)))
source_cpp: int integer_positive_value_positive_negative_value_array_1(vector<int> arr, int n) {
    int neg = 0, pos = 0;
    int sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      sum += arr [ i ];
      if ( arr [ i ] < 0 ) neg ++;
      else pos ++;
    }
    return ( sum / abs ( neg - pos ) );
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return abs(actual - expected) < 1e-09
  
  def driver(arr, n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              arr, n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver([49, 98], 1, 49.0)
      print(f"TEST-0...{result}")
  
      result = driver([82, 66, -68, 24, -10], 2, 74.0)
      print(f"TEST-1...{result}")
  
      result = driver([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 8, 0.125)
      print(f"TEST-2...{result}")
  
      result = driver([56, 3, 18, 5, 20, 56, 47, 29, 60, 98, 60, 40, 42, 2, 54, 56, 91, 8, 93, 14, 31, 27, 61, 49, 23, 12, 71], 25, 41.72)
      print(f"TEST-3...{result}")
  
      result = driver([-94, -94, -92, -86, -50, -48, -6, 8, 28, 40, 44, 58, 62, 72, 94], 12, -146.0)
      print(f"TEST-4...{result}")
  
      result = driver([0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1], 36, 0.5833333333333334)
      print(f"TEST-5...{result}")
  
      result = driver([16, 56, 56], 1, 16.0)
      print(f"TEST-6...{result}")
  
      result = driver([74, -90, -92, 30, -18, 66, -66, 22], 5, -96.0)
      print(f"TEST-7...{result}")
  
      result = driver([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 7, 0.5714285714285714)
      print(f"TEST-8...{result}")
  
      result = driver([21, 64, 82, 78, 30, 34, 35], 5, 55.0)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: integer_positive_value_positive_negative_value_array_1
question_info.test_list: [{"idx": 0, "outputs": 49.0, "inputs": {"arr": [49, 98], "n": 1}}, {"idx": 1, "outputs": 74.0, "inputs": {"arr": [82, 66, -68, 24, -10], "n": 2}}, {"idx": 2, "outputs": 0.125, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], "n": 8}}, {"idx": 3, "outputs": 41.72, "inputs": {"arr": [56, 3, 18, 5, 20, 56, 47, 29, 60, 98, 60, 40, 42, 2, 54, 56, 91, 8, 93, 14, 31, 27, 61, 49, 23, 12, 71], "n": 25}}, {"idx": 4, "outputs": -146.0, "inputs": {"arr": [-94, -94, -92, -86, -50, -48, -6, 8, 28, 40, 44, 58, 62, 72, 94], "n": 12}}, {"idx": 5, "outputs": 0.5833333333333334, "inputs": {"arr": [0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1], "n": 36}}, {"idx": 6, "outputs": 16.0, "inputs": {"arr": [16, 56, 56], "n": 1}}, {"idx": 7, "outputs": -96.0, "inputs": {"arr": [74, -90, -92, 30, -18, 66, -66, 22], "n": 5}}, {"idx": 8, "outputs": 0.5714285714285714, "inputs": {"arr": [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 7}}, {"idx": 9, "outputs": 55.0, "inputs": {"arr": [21, 64, 82, 78, 30, 34, 35], "n": 5}}]
question_info.entry_cls_name: Solution