Hi,<\/p>\n
The subject of this task is to display to the user an approximation of e.<\/p>\n
When a user give you a precision for example 2, you have to display e and to be sure that the two first numbers just after the coma are right.<\/p>\n
To check your result you can use the google approximation.<\/p>\n
I created two function:<\/p>\n
The first one « is_equal »\u00a0function is to respect this point of the subject:\u00a0You will want to use the infinite series to calculate the value, stopping when the accuracy is reached (previous and current calculation are the same at the specified accuracy).<\/p>\n
Be careful you use precision+1 because we want that the number is truncated \u00a0and the round function modify the result.<\/p>\n
The second function reproduced the wikipedia sum formula with factorial.<\/p>\n
Don’t forget to import the math module !<\/p>\n
I initialized in this way :<\/p>\n
e_previous = -1 -> we don’t care because the e_previous = 0 in the first iteration
\ne_current = 0 -> to respect the formula in the first iteration of the while loop
\ni = 0 -> to respect the formula 0! = 1 so e_current = 1 (the first value of the sum)<\/p>\n
Here is my code:<\/p>\n