Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Lab 4 – Python

Lab4

 

Answer:


## Accept the input 'starting principal' from user
p = int(input('Enter the starting principal '))

## Accept the input 'annual interest rate' from user
r = float(input('Enter the annual interest rate '))

## Accept the input 'times per year the interest is compounded' from user
n = int(input('How many times per year is the interest compounded? '))

## Accept the input 'number of years account will earn interest' from user
t = int(input('For how many years will the account earn interest? '))

## Convert the percentge of the annual interest rate to decimal and Calculate ending principle amount using the formula
r = r / 100
a = (p * (1 + r / n) ** (n * t))

## Display the ending principle amount
print('At the end of ',t,"years you will have $ {0:,.2f}".format(a))

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!