from typing import Callable


def runge_kutta_method_o4(f: Callable[[float, float], float], y0: float, x: list[float], h: float, precission: int = 5) -> float:
    """Finds the value of y(x) for some ODE using Runge Kutta method (order 4).

    Params
    ------
    f: Callable[[float, float], float]
        function representing dy/dx, i.e., f(x, y)
    y0: float
        value of y at x0
    x: list[float]
        list of values at which y has to be computed
    h: float
        interval size
    

    Returns
    -------
    float
        value of y(x)
    """

    yi = y0
    for i, xi in enumerate(x[:-1], 1):
        k1 = h*f(xi, yi)
        k2 = h*f(xi + h/2, yi + k1/2)
        k3 = h*f(xi + h/2, yi + k2/2)
        k4 = h*f(xi + h, yi + k3)
        yi = yi + (k1 + 2*k2 + 2*k3 + k4)/6
        print(f"y{i}={yi:.{precission}f}\n\t{k1=:.{precission}f}\n\t{k2=:.{precission}f}\n\t{k3=:.{precission}f}\n\t{k4=:.{precission}f}")

    return yi