Session Ready
Exercise

Simulating periodic payments (II)

You have decided to extend your program from the previous exercise to store the principal and interest payments made at each period, and to plot the results instead of simply printing them.

For this example, the plotting code is already done, so you just need to finish the logic inside the for loop and the initialization of the variables which will be updated at each iteration.

Instructions
100 XP
  • Simply store the interest_paid and principal_paid for each time period.
  • Calculate the principal_remaining for each time period based on the principal payment and the remaining principal.
  • Run the provided code to plot the monthly Interest vs Principal payments.