Answer to Question #305821 in Python for Pyara

Question #305821

At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase by percent each year for the next 5 years. Write a program with a loop that displays the projected semester tuition amount for the next 5 years. 


The program should print out the result in the form


In 1 year, the tuition will be $8002.3.

In 2 years, the tuition will be $8103.2.

In 3 years, …

In 4 years, …

In 5 years, …


(If, for example, the tuition would cost 8002.3dollars in one year, etc.)


Sample Run


In 1 year, the tuition will be $8240.0.↵ 

In 2 years, the tuition will be $8487.2.↵ 

In 3 years, the tuition will be $8741.816.↵ 

In 4 years, the tuition will be $9004.07048.↵ 

In 5 years, the tuition will be $9274.192594400001.↵


1
Expert's answer
2022-03-04T12:31:41-0500
def comp_int(t, r, p):
    for i in range(1, t + 1):
        c_int = p * (1 + r) ** i 
        print('In {} years, the tuition will be ${}'.format(i, c_int))

comp_int(5, 0.03, 8000)

In 1 years, the tuition will be $8240.0
In 2 years, the tuition will be $8487.199999999999
In 3 years, the tuition will be $8741.816
In 4 years, the tuition will be $9004.07048
In 5 years, the tuition will be $9274.192594400001

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS