Python习题册039:计算收益

任务039描述

用Python编写一个程序,已知本金为10000元,年收益率为3.5%,计算7年后的财富值。

分析及示例

已知本金、收益率和存款年限,可以用指数的方式来计算N年后的收益本金总和。

示例代码:

amount = 10000
rate = 3.5
years = 7

futureValue = amount * ((1 + rate*0.01)** years)
print('Future Value:{}'.format(round(futureValue,2)))

输出结果:

Future Value:12722.79

猜你喜欢

转载自blog.csdn.net/weixin_34122604/article/details/87662163
今日推荐