Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use while loop function of python to solve this question, Thank you Suppose we decide to invest some money in an account that continously

Please use while loop function of python to solve this question, Thank you image text in transcribed
image text in transcribed
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 + 0.00417) = 100.417 After the second month, the value in the account becomes (100 + 100.417) *(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 your function. 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. Now, write a new function savingsByMonth() 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 first element, 100.417 as the second element, etc. def savingsByMonth(amount, interest rate, months): Given a monthly contribution amount (e.g., 100), the annual interest rate (e.g., 5), 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" # TODO: replace return "stub" with a correct return stateme Now that you have the list, you can one to your tabertplotapy and use the matplotlib

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago