Question: please code in python 3.7.2 and paste the code please show its running Write a program in Python that computes the interest accrued on an
please code in python 3.7.2 and paste the code please show its running
Write a program in Python that computes the interest accrued on an account. You can modify the futval.py program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute the value in 10 years for example, the program should loop 10 * periods times and accrue rate /period interest on each iteration. If the principal is $1,000.00, yearly interest rate is 0.04 (4%), compounding periods in a year are 4, and the duration is 10 years, then the program should display $1488.86. futval.py def main(): print(" This Program calculates the future value") print(" of a 10-year investment. ") principal = eval(input("Enter the initial principal: ")) apr = eval(input("Enter the initial principal: ")) for i in range(10): principal = principal *(1 +apr) print("The value in 10 years is:",principal) main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
