Untitled
unknown
plain_text
9 months ago
921 B
2
Indexable
# Base year (2008) total weighted price
base_year_price = 1300
# Given data: Total Weighted Prices
years = [2008, 2009, 2010, 2011, 2012, 2013]
total_weighted_prices = [1300, 1500, 1660, 1985, 2000, 2300]
# Initialize lists for CPI, Inflation Rate, and Purchasing Power
cpi = []
inflation_rate = [None] # Inflation for base year is undefined
purchasing_power = []
# Calculate CPI and Purchasing Power
for price in total_weighted_prices:
cpi_value = (price / base_year_price) * 100
cpi.append(cpi_value)
purchasing_power.append(100 / cpi_value)
# Calculate Inflation Rate for each year (starting from 2009)
for i in range(1, len(cpi)):
inflation = ((cpi[i] - cpi[i - 1]) / cpi[i - 1]) * 100
inflation_rate.append(inflation)
# Combine the results into a structured output
results = list(zip(years, total_weighted_prices, cpi, inflation_rate, purchasing_power))
resultsEditor is loading...
Leave a Comment