import math


def exponential(x, epsilon=1e-6):  
    """
    This function calculates exp(x) to a tolerance
    of epsilon.

    Parameters
    ----------
    x :  exponent
    epsilon :  tolerance
    returns :  exp(x), number of terms include (after 1.0)

    Example from interactive shell:
    >>> sum, i = exponential(0.15)
    >>> print i-1, sum
    5, 1.16183422656
    """
    total = 1.0
    i = 1
    term = (x**i) / math.factorial(i)
    
    while abs(term) > epsilon:
        term = x**i / math.factorial(i)
        total += term
        i += 1
    
    return total, i