



'''simple docstring'''





from collections.abc import Callable
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  float							      =					a
    lowerCAmelCase__ :  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:
        lowerCAmelCase__ :  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:
                lowerCAmelCase__ :  Optional[Any]							      =					mid
            else:
                lowerCAmelCase__ :  Union[str, Any]							      =					mid
            lowerCAmelCase__ :  Any							      =					start + (end - start) / 2.0
        return mid
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    return x**3 - 2 * x - 5


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

 import doctest

 doctest.testmod()







'''simple docstring'''





from maths.prime_factors import prime_factors
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    if not isinstance(UpperCamelCase							,    UpperCamelCase			):
        lowerCAmelCase__ :  int							      =					f"""Input value of [number={number}] must be an integer"""
        raise TypeError(UpperCamelCase			)
    if number < 1:
        raise ValueError("""Input must be a positive integer"""			)
    return -1 if len(prime_factors(UpperCamelCase			)			) % 2 else 1


if __name__ == "__main__":
 import doctest

 doctest.testmod()


