Get Started

Future value

The numpy module also contains a similar function, .fv(rate, nper, pmt, pv), which allows you to calculate the future 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)
  • pv: The present value of the investment

It is important to note that in this function call, you must pass a negative value into the pv parameter if it represents a negative cash flow (cash going out). In other words, if you were to compute the future value of an investment, requiring an up-front cash payment, you would need to pass a negative value to the pv parameter in the .fv() function.

This is a part of the course

“Introduction to Financial Concepts in Python”

View Course

Exercise instructions

  • Using NumPy's .fv() function, calculate the future value of a $10,000 investment returning 5% per year for 15 years and assign it to investment_1.
  • Calculate the future value of a $10,000 investment returning 8% per year for 15 years and assign it to investment_2.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

import numpy as np

# Calculate investment_1
investment_1 = ____(rate=____, nper=____, pmt=0, pv=____)
print("Investment 1 will yield a total of $" + str(round(investment_1, 2)) + " in 15 years")

# Calculate investment_2
investment_2 = ____
print("Investment 2 will yield a total of $" + str(round(investment_2, 2)) + " in 15 years")
Edit and Run Code