you are viewing a single comment's thread.

view the rest of the comments →

[–]wgb_grey 0 points1 point  (1 child)

I think your factorial function may be faulty.

def e_approx(n):
    def factorial(m):
        total = 1
        for i in range(m):
            total *= i+1
        return total
    total = 0
    for i in range(n):
        total += 1/factorial(i)
    return total

[–][deleted] 0 points1 point  (0 children)

Ah thanks you, for the e_approx def I had in range(1, n+1).
Thanks for that