新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
Python程序:計(jì)算復(fù)利
創(chuàng)新互聯(lián)python教程:

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、海城ssl等。為上千多家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢(xún)和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的海城網(wǎng)站制作公司
用例子寫(xiě)一個(gè)計(jì)算復(fù)利的 Python 程序。在我們開(kāi)始 Python 復(fù)利程序之前,讓我向您展示復(fù)利背后的公式:
未來(lái) CI =本金金額* ( 1 + ROI ) 年數(shù) )
上述計(jì)算稱(chēng)為未來(lái)復(fù)利。因?yàn)樗窘鸷团渲庙?xiàng)。獲取復(fù)利:復(fù)利=未來(lái)配置項(xiàng)-本金
計(jì)算復(fù)利的 Python 程序
這個(gè) python 程序允許用戶(hù)輸入本金金額、利率和時(shí)間段(年數(shù))。使用這些值, Python 使用上面指定的公式計(jì)算復(fù)利。
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)) 新聞名稱(chēng):Python程序:計(jì)算復(fù)利
文章轉(zhuǎn)載:http://www.dlmjj.cn/article/cdpidpi.html


咨詢(xún)
建站咨詢(xún)
