# How to compute the present value of an annuity in Python

• 1 min## What is an annuity?

An annuity is a series of payments made at equal intervals.

In the real world, for example, it can be understood as regular deposits to a savings account.

As you can find on Wikipedia here is the ordinary annuity formula:

Where

- PV: The present value of an ordinary annuity
- PMT: Value of each payment
- r: interest rate per period
- n: number of periods

## And in Python?

If we literally transpose this formula in Python.

If we take an example with

- PMT = 100$ : Value at each payment
- r = 7% or 0.07 : interest rate per period here 7% per annum.
- n = 5 : 5 years

Here you are! You now know how to compute the present value of an annuity.

# More on financial analysis

If you want to know more about **Financial Analysis in Python** and avoid the headaches... check out the other articles I wrote by clicking just here: