Equation division evaluator
Your task
You are given a list of equations like ["a","b"] meaning a / b = value, plus the parallel list of positive float values. For each query ["x","y"] return the value of x / y computed by chaining known ratios, or -1.0 if it cannot be determined (an unknown variable or a disconnected pair). A query of a variable with itself, if the variable is known, is 1.0. Round each answer to 5 decimal places.
Examples
evaluate_division(equations: list[list], values: list[float], queries: list[list]) -> list[float]Example 1
Input
evaluate_division([["a", "b"], ["b", "c"]], [2, 3], [["a", "c"], ["b", "a"], ["a", "e"], ["x", "x"]])Output
[6, 0.5, -1, -1]