pmt = [0,0,0,0] #劉任昌程式設計586設定串列list
pmt[0]=float(input('躉繳金額: '))
for nper in range(1,4):
pmt[nper] = float(input('第'+str(nper)+'期回收: '))
def npv(rate):
y = - pmt[0]
for j in range(1,4):
y = y + pmt[j]/(1+rate)**j
return y
a, b, gap, f = 0.0, 1.0, 9.0, 9.0
maxerror = 0.000001
loopNumber = 1
while (gap > maxerror and abs(f) > maxerror and loopNumber < 100):
loopNumber+=1
c = (a+b)/2;
f = npv(c);
if ( abs(f) > maxerror and gap > maxerror):
if ( f>0 ):
a = c
else:
b = c
gap = b-a;
print('報酬率: ', c)
print('淨現值: ', f)
print('迴圈次數: ', loopNumber)
https://nanaminagano.blogspot.com/2025/06/h1margin-0-padding-20px-0-color-000000.html
回覆刪除作者已經移除這則留言。
回覆刪除https://lu-chieh-chi.blogspot.com/2025/06/pmt-0000-586list-pmt0floatinput-for.html
回覆刪除https://allyking097.blogspot.com/2025/06/pythonirr.html
回覆刪除https://shanny11336108.blogspot.com/2025/06/pythonirr.html
回覆刪除https://djhdvdhd.blogspot.com/2025/06/blog-post_24.html
回覆刪除https://xiyuying.blogspot.com/2025/06/pythonirr.html
回覆刪除https://xin00.blogspot.com/2025/06/pythonirr.html
回覆刪除https://yangbokai.blogspot.com/2025/06/pythonjavascriptexcelirr.html
回覆刪除https://huangchenyang.blogspot.com/2025/06/pythonjavascriptexcelirr.html
回覆刪除https://lupeiying.blogspot.com/2025/06/blog-post_24.html
回覆刪除https://linchengxun.blogspot.com/2025/06/html-css-javascript-python-java.html
回覆刪除https://yuwun0221.blogspot.com/2025/06/pythonirr.html
回覆刪除https://wuzhiyou.blogspot.com/2025/06/pythonirr.html
回覆刪除https://htmlcss-hsiao.blogspot.com/2025/06/youtube-video-player.html
回覆刪除https://yuanxuzhi.blogspot.com/2025/06/pmt-0000-586list-pmt0floatinput-for.html
回覆刪除