Estimating e

 Estimating e                                                                                                      @PablO_CVi

In this assignment you will estimate the mathematical constant e. You should create a function called calculuate_e which receives one parameter called precision that should specify the number of decimal points of accuracy.

Here is my code: 

def calculate_e(precision):

x = precision

e = (1+1/x)**x

return float(e)

precision=int(input(“How many decimals do you want?”))

a = calculate_e(precision)

round(a,precision)

print(“The estimate of the constant e is: “,a)

 

CC BY 4.0 Estimating e by Pablo is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.