Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

python 1. Start off by creating a variable called balance. Get the users current balance and store it in this variable as a float. 2.

image text in transcribed
image text in transcribed
python
1. Start off by creating a variable called balance. Get the users current balance and store it in this variable as a float. 2. Next, create a variable called interest_rate. Ask the user for the interest they earn yearly on their balance and store the rate as a float. The interest rate should be entered as a decimal (i.e. for 7%, enter 0.07). 3. Afterwards, create a variable called years. Ask the user for the number of years they wish to calculate interest for and store it in this variable as an integer. 4. Create a statement that would output the message "Current Balance: x, where x should display the balance from the balance variable. 5. Create a for loop that uses a counter variable called year and iterates from 0 to the value in years (Remember how the range works. If 7 years is specified, it should iterate from 0-6.) 6. Inside the body of the for statement, write the following: a. Create a variable called interest and set it equal to the balance times the interest rate. Use the round statement to round it off to 2 decimal places. b. Add the value in interest to the value in balance. Store the sum back in balance C. Print the current year (Year 1, 2, 3, 4, etc. Remember that the year variable starts at 0, 50 you may need to print the sum of year and 1) d. Print the interest earned e. Print the balance after interest has been added. 12

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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