compound_interest()接受0个位置参数,但给出了1个

时间:2019-12-22 20:38:56

标签: python

我正在尝试运行此代码以查找不使用直接公式的复利,并且我不确定为什么会收到此错误“ compound_interest()接受0个位置参数,但给出了1个”

我只是想将其用作功能。

def CI(Principle):

    interest = Principle*Rate

    return interest
    return New



Principle = 100

Rate = 0.05
Period = 2
New = 0

m = compound_interest(Period)

def compound_interest(Period):

    while Period >0:

        Interest = CI(Principle)

        Principle = Principle + Interest

        Period = Period -1

        New = Interest + New

        return New

print(New) 

0 个答案:

没有答案