In this Python exercise we generate independent 1000 exponential random variables

In this Python exercise we generate independent 1000 exponential random variables with mean 2 from independent 1000 uniform random variables on (0, 1) by the following steps. (a) Use Python to generate the independent 1000 uniform random variables (say U1, . . . , U1000) on (0,1). (b) Find the inverse function F ?1 (·) of the cumulative distribution function F (x) = 1 ? exp(?(1/2)x) , x > 0 of exponential distribution with mean 2 , that is, F ?1 (F (x)) = x for x > 0 . (c) Using the result of the previous problem, generate exponential random variables (e1, . . . , e1000) in Python byek : = F?1(Uk), k = 1,. . . ,1000. This method is called the inversion method. (Hint: Read section 11. 2. 1). (d) Using Python compute mean and variance of (e1, . . . , e1000) , and then plot its histogram.