Question: python 3 PROBLEM 2 Write a program that isks the user to enter an interest rate (in percentage), and then uses a while loop to

python 3 python 3 PROBLEM 2 Write a program that isks the user to

PROBLEM 2 Write a program that isks the user to enter an interest rate (in percentage), and then uses a while loop to output the number of years it takes for the investment to double at that rate. The program should prompt the user whether or not they want to continue running the program. If the user types yes, the program should repeat (.e. ask for another interest rate and output the number of years it takes for the investment to double at that rate). The program should terminate once the user types no. For this exercise, we will simply assume that the initial investment is equal to $1 because the amount of the initial investment does not matter since the percentage rate of growth of the invest- ment will be the same regardless of the initial amount deposited. An example output is shown below Enter the annual interest rate (%): 5 It takes 15 years for the investment to double Do you want to continue (yeso)? yes Enter the annual interest rate (%): 20 It takes 4 years for the investment to double. Do you want to continue (yeso)? yes Enter the annual interest rate (%): 10 It takes 8 years for the investment to double Do you want to continue (yeso)?no END OF THE SESSION GOOD BYE! PROBLEM 3: Write a program which repeatedly reads numbers until the user enters the word DONE. Once the word DONE is entered, print out the number of valid inputs the sum of all valid inputs the average of the valid inputs. If the user enters anything other than a number, detect their mistake using try and except and print an error message and skip to the next number. An example of output is the following: Enter a number: 4 Enter a number: 5 Enter a number: MLK Invalid input Enter a number: 7 Enter a number: done Total numbers of valid inputs: 3 Sum of valid inputs : 16 Average of valid inputs: 5.333333

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 Databases Questions!