def lagrange(x, y, x_int):
    """
    Interpolates a value using Lagrange polynomial
    Parameters:
        x: Array containing x values
        y: Array containing y values
        x_int: Value to interpolate
    Returns:
        y_int: Interpolated value
    """

    n = x.size
    y_int = 0

    for i in range(0, n):
        p = y[i]
        for j in range(0, n):
            if i != j:
                p = p * (x_int - x[j]) / (x[i] - x[j])

                print('L{}(x) = (x - x_{}) / (x_{} - x_{}) '.format(i, j, i, j))
        y_int = y_int + p

    return [y_int]