import math


def effective_rate(r, m=1, method="continuous"):
    """The effective rate is the rate that gives the same growth factor over a one year period under annual
    compounding.

    Parameters
    ----------
    r: float
        Interest rate
    m: float, optional
        Compounding period. Amount of payments made per annum
    method: str, optional
        Compounding method. It can be "continuous" or "periodic"
    """
    if method == "continuous":
        return math.exp(r) - 1
    elif method == "periodic":
        return (1 + r/m)**m - 1
    else:
        return ValueError("The compounding method is not valid")