<IFRAME WIDTH='100%'SRC='https://zh.wikipedia.org/zh-tw/%E4%BA%8C%E5%88%86%E6%B3%95_(%E6%95%B8%E5%AD%B8)'></IFRAME> head/head, body/body畫蛇添足,可拿掉,因為部落格架構已經下這些命令 <style> h1 {margin: 0;padding:20px 0;color:black; text-shadow: 4px 4px 2px pink;} .Takming {border: 20px outset red;background-color: green; color: white; text-align: center;} .pmt {width: 60pt;height: 20pt;background-color: coral; color: white; text-align: right;} </style> <table border="1"> <tr align="center"><td>躉繳</td><td>第1期</td><td>第2期</td><td>第3期</td></tr> <tr><td><input class="pmt" type="number" /></td> <td><input class="pmt" type="number" /></td> <td><input class="pmt" type="number" /></td> <td><input class="pmt" type="number" />...
發表文章
目前顯示的是 6月, 2025的文章
徐語妏Python與Javascript與EXCEL IRR函數比較
- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
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) 心得:透過這堂課我學習到很多,也收穫很多,謝謝老師這學期的教導,受益匪淺。