





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE				)							-> int:




    """simple docstring"""




    if a < 0:
        raise ValueError('Input value must be a positive integer'				)
    elif isinstance(_SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				):
        raise TypeError('Input value must be a \'int\' type'				)
    return bin(_SCREAMING_SNAKE_CASE				).count('1'				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()












from collections.abc import Callable





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    _A     =							a
    _A     =							b
    if function(_SCREAMING_SNAKE_CASE				) == 0:  # one of the a or b is a root for the function
        return a
    elif function(_SCREAMING_SNAKE_CASE				) == 0:
        return b
    elif (
        function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) > 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:
        _A     =							start + (end - start) / 2.0
        while abs(start - mid				) > 10**-7:  # until precisely equals to 10^-7
            if function(_SCREAMING_SNAKE_CASE				) == 0:
                return mid
            elif function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) < 0:
                _A     =							mid
            else:
                _A     =							mid
            _A     =							start + (end - start) / 2.0
        return mid





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    return x**3 - 2 * x - 5


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

 import doctest

 doctest.testmod()





