We paid $15,000 each year from 1988 to 2007 (20 years). Using the CPI calculator at http://data.bls.gov/cgi-bin/cpicalc.pl?cost1=15000&year1=2016&year2=1988, we can calculate the total value in current dollars. This will not be completely accurate as we made two payments each year, not one. But it will be very close.
In [1]:
import requests
from lxml import html
from re import sub
from decimal import Decimal
In [2]:
payment = 15000
target_year = 2016
dollars_2016 = 0
for year in range(1988,2008):
url='http://data.bls.gov/cgi-bin/cpicalc.pl?cost1=%i&year1=%i&year2=%i' % (payment,year, target_year)
print(url)
page = requests.get(url)
tree = html.fromstring(page.content)
money = tree.xpath('//span[@id="answer"]/text()')[0]
print(money)
value = Decimal(sub(r'[^\d.]', '', money))
dollars_2016 += value
In [3]:
print(dollars_2016)
In [ ]: