You are a personal financial advisor and you frequently need to tell individuals how many years...

70.2K

Verified Solution

Question

Programming

You are a personal financial advisor and you frequently need totell individuals how many years it will take them to reach theirretirement goals given their returns on their various accounts. Youplan to write a Python program that helps you calculate thesereturns.

You must take in three pieces of input:

  • Starting balance amount as an integer or float (how much moneyyou wish to start a savings/market account with)
  • The APR as a float (the percentage return as a decimal, i.e.0.04 for 4 percent)
  • The goal as an integer or float (this is basically the amountof money we want to reach before stopping)

Given those inputs above, we need to write a loop (we don't knowhow many iterations) that will continue to add our interest to ourbalance, until we've reach our goal, at which point the loopingstops. We want to know how many years (iterations) it took to reachthis goal, so keep track of a count each iteration of the loop.

To add interest to a balance you can think of a balance variablecalled b and we would use the following math:

b = b + b * apr

If the APR is a deciaml 0.04, then 100 * 0.04 becomes 4... thusour first year earned us 4 dollars making our balancing 104.

Print out the balance and the year each iteration of the loop.See the example screenshot below:

Answer & Explanation Solved by verified expert
4.1 Ratings (816 Votes)
Please find below the code code screenshots and outputscreenshots Please refer to the screenshot of the code tounderstand the indentation of the    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students