本文介绍了我如何...让我的代码返回n的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它假设要返回n但它没有帮助请求



我尝试过:



ef pay_off_period(PV,PMT,i):

年= 0

n =年

投资= 0

FV = 0

而FV< = PV:

interest = FV *(i)

FV + =兴趣

FV + = PMT

年= + 1

#investment = round(FV /(1 + i)** n, 1)



返回int(n)

it suppose to return n but it doesnt help pleas

What I have tried:

ef pay_off_period(PV, PMT, i):
years = 0
n = years
investment = 0
FV = 0
while FV <= PV:
interest = FV*(i)
FV += interest
FV += PMT
years =+1
#investment =round(FV/(1 + i)**n,1)

return int(n)

推荐答案


def pay_off_period(PV, PMT, i):
  years = 0
  FV = 0
  while FV <= PV:
    interest = FV*(i)
    FV += interest
    FV += PMT
    years += 1
  return years



这篇关于我如何...让我的代码返回n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-28 07:16