如何将get...
函数的返回值传递给addInt
函数,以使investment
函数正常运行?
非常感谢任何帮助。
谢谢
def addInt(initBal, deposit, term, intRate):
for i in range(term):
newBal = initBal * intRate
print(round(newBal, 2))
newBal = newBal + deposit
initBal = newBal
print(addInt(2000, 2000, 120, 1.025))
def getInitBal():
initBal = input('Enter starting balance: ')
return initBal
def getDeposit():
deposit = input('Enter monthly deposit: ')
return deposit
def getTerm():
term = input('Enter investment term: ')
return term
def getIntRate():
intRate = input('Enter monthly interest rate: ')
return intRate
def getArgs():
getInitBal()
getDeposit()
getTerm()
getIntRate()
def investment():
getArgs()
addInt(initBal, deposit, term, intRate)
investment()