扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
创新互联python教程:

我们提供的服务有:成都网站设计、成都做网站、微信公众号开发、网站优化、网站认证、海城ssl等。为上千多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的海城网站制作公司
用例子写一个计算复利的 Python 程序。在我们开始 Python 复利程序之前,让我向您展示复利背后的公式:
未来 CI =本金金额* ( 1 + ROI ) 年数 )
上述计算称为未来复利。因为它包含本金和配置项。获取复利:复利=未来配置项-本金
这个 python 程序允许用户输入本金金额、利率和时间段(年数)。使用这些值, Python 使用上面指定的公式计算复利。
import math
princ_amount = float(input(" Please Enter the Principal Amount : "))
rate_of_int = float(input(" Please Enter the Rate Of Interest : "))
time_period = float(input(" Please Enter Time period in Years : "))
ci_future = princ_amount * (math.pow((1 + rate_of_int / 100), time_period))
compound_int = ci_future - princ_amount
print("Future Compound Interest for Principal Amount {0} = {1}".format(princ_amount, ci_future))
print("Compound Interest for Principal Amount {0} = {1}".format(princ_amount, compound_int)) 
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流