Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 2 - Elementary Programming - Programming Exercises - Page 58: 2.11

Answer

Program: # prompt user for final account value, annual interest # rate and number of months of deposit finalAccountValue= eval(input( "Enter final account value: ")) annuallnterestRate= eval(input( "Enter annual interest rate in percent: ")) numberOfYears= eval(input("Enter number of years: ")) # Compute the initial deposit amount initialDepositAmount = finalAccountValue $/\left((1+(\text { annuallnterestRate/1200 }))^{* *}\right.$ (numberOfYears*12)) #Display the initial deposit amount print("Initial deposit value is ", initialDepositAmount)

Work Step by Step

Step 1 of 3: Program Plan: Create a python file with name 2_11PE.PY. In the file, - Get individual inputs from user. They are the final account value, annual interest rate and number of months of deposit. - Compute the initial deposit amount based on the formula given in question. - Display the initial deposit amount. Step 2 of 3: Program: # prompt user for final account value, annual interest # rate and number of months of deposit finalAccountValue= eval(input( "Enter final account value: ")) annuallnterestRate= eval(input( "Enter annual interest rate in percent: ")) numberOfYears= eval(input("Enter number of years: ")) # Compute the initial deposit amount initialDepositAmount = finalAccountValue $/\left((1+(\text { annuallnterestRate/1200 }))^{* *}\right.$ (numberOfYears*12)) #Display the initial deposit amount print("Initial deposit value is ", initialDepositAmount) Step 3 of 3: Sample Output: Enter final account value: 1000 Enter annual interest rate in percent: $4.25$ Enter number of years: 5 Initial deposit value is $808.8639197424636$
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.