PLEASE ONLY WRITE THE SECOND (SAVINGBYMONTH) CODE
Please note that we have to add amount 100 into the account every month instead of only 100 from the begging to the end.
THANK YOU !!!! Please use while loop instead of for loop and use some pytest
Applications : Continuously Compounded Interest Suppose we decide to invest some money in an account that continously compounds interest. In other words, the amount that we initially invested is constantly earning interest and any interest that we earned also keeps acquiring interest. At first, let's compute our earnings in the short term. Suppose you save $100 each month into a savings account that has an annual interest rate of 5%. So, the monthly interest rate is 0.05/12 : 0.00417. After the first month, the value in the account becomes 100 :1: (1 l 0.00417) : 100.417 After the second month, the value in the account becomes (100 + 100.417) =1 (1 1 0.00417) : 201.252 After the third month, the value in the account becomes (100 + 201.252) * (1 0.00417) : 302.507 and so on. Before you begin writing any code, try writing out the pseudocode for yourfunction. Think about how you would calculate the compound interest if you did the math by hand and use this to help you in the implementation. Write a function savings that computes and returns the savings amount after the given month, given a monthlyf contribution amount [e.g., 100), the annual interest rate (e.g., 5), and the number of months (e.g.. 6), . Use the while loop to implement this function. def savings(amount, interest_rate, months): Given a monthly contribution amount (e.g., 180), the annual interest rate (e.g., 5L and the number of months (e.g., 6), returns the savings amount after the given month. return "stub" # TODD: repLoce return "stub" with a correct return statement Now, write a new function savingsByMonthE) that will save each month's savings as a new element in the list, which gets returned from the function. So, in the example above, the list would have the initial amount stored as the rst element, 100.417 as the second element etc. def savingsyonth(amount, interest_rate, months}: Given a monthly contribution amount (e.g., 180), the annual interest rate (e.g., 5L and the number of months (e.g., 6), returns a list with the savings amount For each month, including the initial amount as the first element, and the savings in the given month as the last element. return "stub" # TODD: repLoce return "stub" with a correct return statement Now that you have the list, you can switch to your Iab4_plotpy and use the matplotlib package to visualize the earnings