Exercise

# Present value

Luckily for you, there is a module called `numpy`

which contains many functions which will make your life much easier when working with financial values.

The `.pv(rate, nper, pmt, fv)`

function, for example, allows you to calculate the present value of an investment as before with a few simple parameters:

**rate:**The rate of return of the investment**nper:**The lifespan of the investment**pmt:**The (fixed) payment at the beginning or end of each period (which is 0 in our example)**fv:**The future value of the investment

You can use this formula in many ways. For example, you can calculate the present value of future investments in today's dollars.

Instructions

**100 XP**

- Import
`numpy`

as`np`

. - Using Numpy's
`.pv()`

function, compute the present value of an investment which will yield $10,000 15 years from now at an inflation rate of 3% per year and assign it to`investment_1`

. - Compute the present value of the same investment, but with a time horizon of only 10 years and an inflation rate of 5%, assigning it to
`investment_2`

.