
"""simple docstring"""




def 			_lowerCAmelCase		(		_UpperCamelCase    ):






  """simple docstring"""



  _lowercase:      Optional[int]   			=  len(_UpperCamelCase    )
  _lowercase:      Tuple   			=  sum(_UpperCamelCase    )

  _lowercase:      str   			=  [[False for x in range(s + 1    )] for y in range(n + 1    )]

  for i in range(1			,					n + 1    ):
    _lowercase:      Optional[int]   			=  True

  for i in range(1			,					s + 1    ):
    _lowercase:      List[str]   			=  False

  for i in range(1			,					n + 1    ):
    for j in range(1			,					s + 1    ):
      _lowercase:      Dict   			=  dp[i][j - 1]

      if arr[i - 1] <= j:
        _lowercase:      int   			=  dp[i][j] or dp[i - 1][j - arr[i - 1]]

  for j in range(int(s / 2    )			,					-1			,					-1    ):
    if dp[n][j] is True:
      _lowercase:      List[Any]   			=  s - 2 * j
      break

  return diff


"""simple docstring"""




from collections.abc import Callable




def 			_lowerCAmelCase		(		_UpperCamelCase			,					_UpperCamelCase			,					_UpperCamelCase    ):






  """simple docstring"""



  _lowercase:      float   			=  a
  _lowercase:      float   			=  b
  if function(_UpperCamelCase    ) == 0:  # one of the a or b is a root for the function
    return a
  elif function(_UpperCamelCase    ) == 0:
    return b
  elif (
      function(_UpperCamelCase    ) * function(_UpperCamelCase    ) > 0
  ):  # if none of these are root and they are both positive or negative,
    # then this algorithm can't find the root
    raise ValueError('''could not find root in given interval.'''    )
  else:
    _lowercase:      float   			=  start + (end - start) / 2.0
    while abs(start - mid    ) > 10**-7:  # until precisely equals to 10^-7
      if function(_UpperCamelCase    ) == 0:
        return mid
      elif function(_UpperCamelCase    ) * function(_UpperCamelCase    ) < 0:
        _lowercase:      Union[str, Any]   			=  mid
      else:
        _lowercase:      Any   			=  mid
      _lowercase:      List[Any]   			=  start + (end - start) / 2.0
    return mid




def 			_lowerCAmelCase		(		_UpperCamelCase    ):






  """simple docstring"""



  return x**3 - 2 * x - 5


if __name__ == "__main__":
  print(bisection(f, 1, 1_0_0_0))

  import doctest

  doctest.testmod()
