|
python 普通存款(单利)计算公式:
代码如下:
|
- #普通存款 单利计算公式:a:原值,n:计算年限,li:利率(小数),
- def danli(a,n,li):
- print("普通存款(单利)计算公式:")
- print("存款本金:"+str(a)+",存款年限:"+str(n)+",存款利率:"+str(li))
- l=a*li*n
- b=a+l
- print(str(n)+"年后:存款金额:"+str(b)+",利息:"+str(l))
- def main():
- danli(50000,5,0.034)
- print("=================================")
- danli(50000,10,0.034)
- print("=================================")
- danli(50000,15,0.034)
- print("=================================")
- danli(50000,20,0.034)
复制代码
|
|