Question: #Parameter variables hold the arguments supplied in the function call. #Calculate the number of years it will take to accumulate $100,000 #per a periodic investment.
#Parameter variables hold the arguments supplied in the function call. #Calculate the number of years it will take to accumulate $100,000 #per a periodic investment. #Initialize Variables #The mean yearly stock market return is 12% meanRate = .12 principal = 400 monthlyDeposit = 400 #Define a function named calcYearsTo100K with parameters meanRate, #monthlyDeposit and principal in that order. rate = meanRate/12 months = 0 while principal <= 100000: principal = principal + (monthlyDeposit * rate) + monthlyDeposit months += 1 years = months/12 return years #Call function and assign return value to numberOfYears #Use the variables listed in the "Initialize Variables" section #as the arguments. Make sure they are in the correct order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
