Question: #Write a function that calculates the Future Value of a monthly investment. #It is perfectly legal to use the same names for the function parameters

#Write a function that calculates the Future Value of a monthly investment. #It is perfectly legal to use the same names for the function parameters #and the arguments used to call the function. #The output for the first pass should be: #Future Value is $ 138122.05 principal = 7000 rate = .12 monthlyDeposit = 500 yearsInvested = 10 #Write a header for a function called compound with 4 parameters: principal #rate, monthlyDeposit, and yearsInvested #assign r = rate divided by 12 (represents 12 months) #create a for loop to calculate the future value #hint: loop through yearsInvested using range function #then loop through 12 months using range function (nested loop), #and update principal using r for the rate #assume that the monthlyDeposit is available at the end of the month #so interest should not be calculated for the monthlyDeposit instead the #deposit should be added directly to the principal. #return principal, should be aligned with the first 'for' statement #Call the function compound using arguments principal, rate, monthlyDeposit, and yearsInvested, in that order. Assign to futureValue.#Print using %12.2f as the string format operator # "Future Value is $

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!