Posts

Image
嵌入劉任昌解說影片 以下程式碼 pmt = [0,0,0,0] #林庭揚程式設計586設定串列list pmt[0]=float(input('大帥哥躉繳金額: '))#float轉換成實數 float 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.00000001 loopNumber = 1 while (gap > maxerror and abs(f) > maxerror and loopNumber maxerror and gap > maxerror): if ( f>0 ): a = c else: b = c gap = b-a; print('大帥哥報酬率: ', c) print('大帥哥淨現值: ', f) print('大帥哥迴圈次數: ', loopNumber)

林庭揚二分法求內部報酬率

Image
躉繳 第1期 第2期 第3期 注意,包含首期躉繳的現金流量都大於0。 輸出: 報酬率: 淨現值: 迴圈次數: 林庭揚向劉任昌學習程式設計程式碼如下
Javascript在網頁就可以執行不需要開啟Spyder sin執行 cos執行 橫軸
Javascript在網頁就可以執行不需要開啟Spyder sin執行 cos執行 橫軸

林庭揚Javascript執行三角函數繪圖

Image
Javascript在網頁就可以執行不需要開啟Spyder 林庭揚執行
from tkinter import * #或者import tkinter as tk import math #第9列(z1=10), 13列(廣域變數),插入16列cos,插入18繪圖 tk = Tk() #建構視窗名為tk tk.geometry('1200x400') tk.title("劉任昌python tkinter三角函數") canvas = Canvas(tk, width=1200, height=400, bg='gray') canvas.grid(row=0,column=0,padx=5,pady=5,columnspan=3) delay=20 # milliseconds, 1/1000秒 x1,y1,z1=0,200,10 #Python特徵: 多變數=多個值 h=190 #上下範圍 degree=0 #角度degree def LauHou(): global x1, y1, z1 x2 = x1 + 1 y2=200 - h*math.sin(0.02*x2)#座標從左上角0.... z2=200 - h*math.cos(0.02*x2) l1=canvas.create_line(x1,y1,x2,y2,fill='red',width=5) l2=canvas.create_line(x1,z1,x2,z2,fill='yellow',width=5) if (x2 小於 1200): #沒有超過, 記得將 "小於" 改成運算 x1,y1,z1=x2,y2,z2 canvas.after(delay,LauHou) else: return LauHou() #執行LauHou老猴 tk.mainloop()

林庭揚Javascript網頁Bottom按鈕事件Onlick呼叫函數

物件導向設計OOP=Object-Oriented Programming 主詞subject受詞object東方的oriental id=identity,身分證id card, division區塊,段落 林庭揚執行 函數名稱()將要執行的程式碼用curly braces圍住 PYTHON換列就是;區隔指令。PYTHON同一個縮排,就是{}的同一個區塊