Session Ready
Exercise

Discounting cash flows

You can use numpy's net present value function numpy.npv(rate, values) to calculate the net present value of a series of cash flows. You can create these cash flows by using a numpy.array([...]) of values.

Compute the NPV of the same cash flows from the following project, but assuming different discount rates:

Year Cash Flow
1 $100
2 $100
3 $100
4 $100
5 $100
Instructions
100 XP
  • Calculate the net present value of the investment with cash_flows at a discount rate of 3% per year, and assign it to investment_1.
  • Repeat the process with a discount rate of 5% per year, and assign it to investment_2.
  • Repeat the process with a discount rate of 7% per year, and assign it to investment_3.