In my code, I ask for the value of two integers twice and I need to add the values entered for each int respectively
year_of_interest = int(input('Please enter the year that you want to calculate the personal interest rate for : '))
expenditure_categories = int(input('Please enter the number of expenditure categories: '))
for i in range(expenditure_categories):
print
expenses_prev_year = int(input('Please enter expenses for previous year: '))
expenses_year_interest = int(input('Please enter expenses for year of interest: '))
total_expenses_prev_year = expenses_prev_year+expenses_year_interest
total_expenses_year_interest = expenses_year_interest+expenses_year_interest
inflation_rate = ((total_expenses_year_interest-total_expenses_prev_year)/total_expenses_year_interest)*100
print("Personal inflation rate for", str(year_of_interest), "is", str(inflation_rate))`
The inputs I provided were:
- year_of_intrest = 2022
- expenditure_categories = 2
- expenses_prev_year = 100 and 200
- expenese_year_of_interest = 100 and 300
The calculated inflation rate I get is 16.67, I should be getting 25