Question: Please read the instructions. Provide a sample of the code with the passed test cases. Please do not use f - strings or advance programming,
Please read the instructions. Provide a sample of the code with the passed test cases. Please do not use fstrings or advance programming, no hardcoding. Please provide a sample of the code with the passed test cases.
Calculating Investments
In this short project, you will calculate how many years it takes for an account balance to reach an
investment goal.
Name the program investment. py Make sure that gradescope gives you the points for passing the test
cases.
Description of the problem
Here's the problem to solve:
Imagine you have amount of dollars in an investment account that earns interest per year.
How long in years does it take for the account balance to be times the original investment?initialamount goalofinvestment
message investmentyearsinitialamount, goalofinvestment
printmessage
The investment of $ will be times larger in years. Development strategy
You will need to use a while loop to solve this problem. You need to calculate what the goal amount is
and you will calculate how much each passing year accrues until you get to the goal.
You will also need to create a year variable to count how many years it takes to achieve the goal.
Remember to increment year with every iteration.
Calculate the interest multiply balance by and the balance add interest to it in each iteration as
well.
Test cases
def main:initialamount goalofinvestment
message investmentyearsinitialamount, goalofinvestment
printmessageprintinvestmentyearsmain
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
