Python and Time Value of Money

Let’s take a look at how to use Python to determine the future and present value of money.

To do this, we’re going to look at the current PowerBall Jackpot and see how much a potential winner might get.

As of Saturday, March 13, 2021, the current jackpot is $169 million.

According to the PowerBall website, a winner may choose to receive their winnings in 30 payments spread out over 29 years.

A Powerball jackpot winner may choose to receive their prize as an annuity, paid inĀ 30 graduated payments over 29 years, or a lump-sum payment (cash option). For the annuity, the annual payments increase by 5%. The cash value option, in general, is the amount of money required to be in the jackpot prize pool, on the day of the drawing, to fund the estimated jackpot annuity prize.

PowerBall.com FAQ

How much would a winner get if they chose to get a lump-sum payment?

We can calculate the future value of money with Python using this formula:

np.pv(rate= , nper= , pmt= , fv= )

  • rate: the rate at which the annuity increases (5%)
  • nper: over how many years the money if received (30)
  • pmt: regular payments made to the fund (0)
  • fv: future value of the money (169,000,000)

We have to import the numpy package to process this calculation.

Looks like a potential winner would get $39,102,788 as a lump sum payment.

Investing in the Stock Market

One of the best things you can do for you personal finances is to invest in the stock market. And unless you’re trying to be a day trader, long term investing is the way to go for most of us.

Let’s say your net annual salary is $55,000 and you want to start investing.

Let’s take it a step further and assume you want to invest 15% of your take-home pay and you’re starting off with $1000 seed money.

Hopefully you’re a savvy enough investor to get an 8% return.

We’ll use Python’s future value tools to calculate how much you might end up with after 20 years.

Here are the details:

  • Initial investment: $1000
  • Annual contribution: $55,000 * 0.15 = $8250
  • Time in years: 20
  • Rate: 8%

This is the formula to calculate future value of money in Python:

np.fv(rate= , nper= , pmt= , pv= )

Take note: when calculating the future value, the input for pv must be negative.

If one were to follow this formula, they would have $372,875 after twenty years.

By Muttaqi Ismail

Muttaqi Ismail is a man whose love for data analytics and reporting has become the cornerstone of his professional journey. With a background in accounting, he seamlessly blends his analytical prowess with his passion for numbers, making significant strides in the realm of data science.

Leave a comment

Your email address will not be published. Required fields are marked *