def compound_interest(principle, time, rate):
amount = principle * (pow((1 + rate / 100), time))
return amount - principle
print('The compound interest is: ', compound_interest(10000, 10.25, 5))输出应该是6288.946267774416,但我得到了6488.848034974573。这里出了什么问题?
发布于 2020-08-30 05:58:09
当调用时,你意外地颠倒了你的时间和速率参数。
你应该这样称呼它:
compound_interest(10000, 5, 10.25)不是compound_interest(10000, 10.25, 5)
https://stackoverflow.com/questions/63652139
复制相似问题