diff --git a/Calculate Compound Interest/calculateCompoundInterest.py b/Calculate Compound Interest/calculateCompoundInterest.py index a081393c..6c22d6da 100644 --- a/Calculate Compound Interest/calculateCompoundInterest.py +++ b/Calculate Compound Interest/calculateCompoundInterest.py @@ -4,7 +4,7 @@ print('How much money is currently in your account?') principal = float(input('Enter current amount in account: ')) -print ('How much money do you plan on investin monthly?') +print ('How much money do you plan on investing monthly?') monthly_invest = float(input('Enter amount: ')) print ('What do you estimate will be the yearly interest of this investment?') @@ -12,12 +12,9 @@ print(' ' ) monthly_invest = monthly_invest * 12 -final_amount = 0 +final_amount = principal for i in range(0, years): - if final_amount == 0: - final_amount = principal + final_amount = (final_amount + monthly_invest) * (1 + interest) -final_amount = (final_amount + monthly_invest) * (1 + interest) - -print("This is how much money you would have in your account after {} years: ".format (years) + str(final_amount)) +print("This is how much money you would have in your account after {} years: ".format(years) + str(round(final_amount, 2)))