發表文章

賴昀威Python與JavaScript程式碼對照

圖片
賴昀威輸入參數 輸入k 輸入m 輸入n 執行自訂函數 重點 alert內建函數,自訂函數abc 賴昀威輸出結果

賴昀威Python自訂函數迴圈write模式a與w

圖片
上面的程式碼   <style>   h1{background-color: purple; color: white; border: 10px solid red; text-align:center; padding: 5px}   ul{background-color: green; color: white; font-size: 2em;line-height:1.5} </style> VS code截圖 程式碼 space, slash, backslash, cr = ' ', '/', '\\', '\n' def row1(k,m):#定義自訂函數 for i in range(1, k+1): for ii in range(m): for j in range(k-i): f.write(space) f.write(slash) for j in range(2*i-2): f.write(space) f.write(backslash) for j in range(k-i): f.write(space) f.write(cr) def row2(r,m): for i in range(1, k+1): for ii in range(m): for j in range(i-1): f.write(space) f.write(backslash) for j in range(2*k-2*i): f.write(space) f.write(slash) for j in range(i-1): f.write(space) ...

賴昀威檔案處理

圖片
f = open("ascii.txt", "r",encoding='utf8') print(f.read()) f.close() x = "賴昀威" f = open("ascii.txt", "r+",encoding='utf8') y = f.write(x) print(y) f.close() f = open("ascii.txt", "r+",encoding='utf8') #a代表附加append print("名稱",f.name) print("模式",f.mode) print("關閉",f.closed) f.write('賴昀威') line = f.read() #讀取檔案f成為字串 print('檔案字串長度',len(line)) print("檔案內容",line) f.close() 影片380

賴昀威Python字串string方法methods

圖片
單元371影片 vs code與w3schools截圖 程式碼 txt = "香蕉" x = txt.center(20) print(x) txt = "賴昀威 love 香蕉, 香蕉是我 favorite 水果香蕉" print(txt.count("香蕉")) print('先練習內建函數len',len(txt)) print('find',txt.find("香蕉")) print('rfind',txt.rfind("香蕉")) print('index',txt.index("香蕉")) w3school自串方法列表 Method Description capitalize() Converts the first character to upper case casefold() Converts string into lower case center() Returns a centered string count() Returns the number of times a specified value occurs in a string encode() Returns an encoded version of the string endswith() Returns true if the string ends with the specified value expandtabs() Sets the tab size of the string find() Searches the string for a specified value and returns the position of where it was found format() Formats specified values in a string format_map() Formats specified values in a string index() Searches the string for a specified value ...

賴昀威HTML_CSS_Javascript_Java_Python

圖片
Java程式碼 import java.awt.*; import java.awt.geom.Line2D; import javax.swing.*; public class Options { public static void main(String[] args) { JFrame frame = new JFrame("賴昀威Java繪製選擇權到期日損益"); Container cp = frame.getContentPane(); cp.add(new JComponent() { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(5));//stroke中風,筆觸 g2.setFont(new Font("monospaced", Font.BOLD, 16)); g2.drawString("買入賣權到期日損益",0,120); g2.draw(new Line2D.Float(0, 0, 100, 100)); g2.draw(new Line2D.Float(100, 100, 200, 100)); g2.drawString("買入買權到期日損益",300,120); g2.draw(new Line2D.Float(300, 100, 400, 100)); g2.draw(new Line2D.Float(400, 100, 500, 0)); g2.drawString("賣出賣權到期日損益",0,180); g2.draw(new Line2...

賴昀威金融市場158至170數學符號輸入Math

圖片
金融市場常識題庫158至163 金融市場常識題庫164至170 mfrac=math fraction分數text文字 ms商業套裝C, 除權息參考價 除權前一天60除權無償配股利的開盤參考價 除權息前一天價值=除權息當天價值 60=3+x⇒x=57 除權前一天60除權2元股票股利的開盤參考價 除權息前一天價值=除權息當天價值 60=(1+ 2 10 )x=1.2x⇒x= 60 1+0.2 =50 除權前一天60除權2元股票股利+3元現金股利的開盤參考價 除權息前一天價值=除權息當天價值 60=3+(1+ 2 10 )x=1.2x⇒x= 60-3 1+0.2 =47.5 練習mroot開平方msqrt 7 2 大約1(1+0.1) 開平方 100.0 =10 信用戶維持率 fraction分數 融資戶維持率= 融資購買股票現在的價值 融資的金額 division軍團區塊 融券維持率= 放空股票的金額+保證金 放空股票的現在價值 整戶維持率=上面分子加分子 / 分母加分母 劉任昌358影片

賴昀威JavaScript物件CANVAS繪製選擇權到期日損益

圖片
canvas繪圖套件繪製選擇權到期日損益圖 identifier名稱,身分證id card w3schools學物件 心得 delete 物件的.屬性; 增加物件band["singer"]