|
python 存款复利计算公式:
代码如下:
- #存款 复利计算公式:a:原值,n:计算年限,li:利率(小数),
- def fuli(a,n,li):
- print("复利计算公式:")
- print("存款本金:"+str(a)+",存款年限:"+str(n)+",存款利率:"+str(li))
- for i in range(n):
- i+=1
- b=a*((1+li)**(i))
- print(str(i)+"年后:存款金额:"+str(b))
- def main():
- fuli(50000,20,0.034)
复制代码
|
|
|