https en wikipedia orgwikiwheatstonebridge this function can calculate the unknown resistance in an wheatstone network given that the three other resistances in the network are known the formula to calculate the same is rxr2r1r3 usage examples wheatstonesolverresistance12 resistance24 resistance35 10 0 wheatstonesolverresistance1356 resistance2234 resistance3976 641 5280898876405 wheatstonesolverresistance12 resistance21 resistance32 traceback most recent call last valueerror all resistance values must be positive wheatstonesolverresistance10 resistance20 resistance32 traceback most recent call last valueerror all resistance values must be positive https en wikipedia org wiki wheatstone_bridge this function can calculate the unknown resistance in an wheatstone network given that the three other resistances in the network are known the formula to calculate the same is rx r2 r1 r3 usage examples wheatstone_solver resistance_1 2 resistance_2 4 resistance_3 5 10 0 wheatstone_solver resistance_1 356 resistance_2 234 resistance_3 976 641 5280898876405 wheatstone_solver resistance_1 2 resistance_2 1 resistance_3 2 traceback most recent call last valueerror all resistance values must be positive wheatstone_solver resistance_1 0 resistance_2 0 resistance_3 2 traceback most recent call last valueerror all resistance values must be positive
from __future__ import annotations


def wheatstone_solver(
    resistance_1: float, resistance_2: float, resistance_3: float
) -> float:
    

    if resistance_1 <= 0 or resistance_2 <= 0 or resistance_3 <= 0:
        raise ValueError("All resistance values must be positive")
    else:
        return float((resistance_2 / resistance_1) * resistance_3)


if __name__ == "__main__":
    import doctest

    doctest.testmod()