【发布时间】:2021-10-10 02:11:27
【问题描述】:
复利计算器
#输入
P = (float, input("Enter the starting principal: ") )
R = (float, input("Enter the annual interest rate: ") )
m = (int, input("How many times per year is the interest compounded? ") )
t = (float, input("For how many years will the account earn interest? ") )
#计算
#FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)
FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)
#输出
print("At the end of ", t, "years. You will have $", format(FV, ",.2f") )
【问题讨论】: