How to Calculate the Present Value using Python

Here is a simple template to calculate the Present Value (pv) using Python:

fv = future value
r = interest rate
n = number of periods

pv = fv/(1+r/100)**n

print(pv)

Steps to Calculate the Present Value using Python

Step 1: Gather your Data

To start, you’ll need to gather the data for the Present Value calculation.

For example, let’s say that you collected the following data:

  • Future value (fv) = 1000
  • Interest rate (r) = 4%
  • Number of periods (n) = 7

Step 2: Calculate the Present Value

To calculate the Present Value (pv) using Python:

fv = 1000
r = 4
n = 7

pv = fv/(1+r/100)**n

print(pv)

Run the code in Python and you’ll get the PV of 759.917