發表文章

李政翰python寫入write讀出read文字檔

圖片
VS code開發環境截圖 程式碼 space, slash, backslash, cr = ' ', '/', '\\', '\n' k = input('輸入三角形的邊長: ') m = input('輸入橫向規模: ') k, m = int(k), int(m) #將字串k轉integer f = open("李政翰.txt",'w',encoding="utf8") handsome = 'huginn hrafn'+cr f.write(handsome) 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) 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): ...

李政翰python檔案file方法methods

圖片
UTF8 encoding編碼 練習程式碼 f = open("ascii.txt", "r+", encoding='utf8') x = f.read() print(x) f.write("\n李政翰") #寫入字串 f.close() #李政翰關閉檔案 print('f長度',len(x)) for i in x: #用迴圈印出每一個字元 print(i) 影片377 影片378 ascii art字元藝術

李政翰python內建built-in函數function迴圈loop範圍range

圖片
style指令原始碼 <style>h1{text-align:center; background-color:blue; color: white;  border: solid medium blue; padding 10px;}   </style> vscord與w3school截圖 y = 0 for a in range(10,99,5): y = y+1 print("第幾", y, "次") print(a) #前面縮排同一個區塊 w3school內建函數列表 Function Description abs() Returns the absolute value of a number all() Returns True if all items in an iterable object are true any() Returns True if any item in an iterable object is true ascii() Returns a readable version of an object. Replaces none-ascii characters with escape character bin() Returns the binary version of a number bool() Returns the boolean value of the specified object bytearray() Returns an array of bytes bytes() Returns a bytes object callable() Returns True if the specified object is callable, otherwise False chr() Returns a character from the specified Unicode code. classmethod() Converts a method into a class method compile() Returns the specified source as an object, ready ...

李政翰電腦科技發展歷史:軟體vs硬體

圖片
黃仁勳Jensen維基百科 黃仁勳維基百科嵌入以上網頁指令 <iframe width="100%" height="400" src="https://zh.wikipedia.org/zh-tw/%E9%BB%83%E4%BB%81%E5%8B%B3"></iframe> 蘇姿丰Lisa Su維基百科 蘇姿丰維基百科嵌入以上網頁指令 <iframe height="400" src="https://zh.wikipedia.org/zh-tw/%E8%98%87%E5%A7%BF%E4%B8%B0" width="100%"></iframe> nvidia, amd, tsm, intel過去一年股價表現 在紐約證券交易所交易的TSM是台積電在美國上市的ADR美國存託憑證,一股ADR是五股台灣股票。

李政翰Python字串string方法methods

圖片
VS Code與w3school截圖 程式碼 txt = "hello李政翰, and welcome to my world." x = txt.capitalize() print (x) a = "Hi,李政翰很Handsome,dumb!weird!我使用w3schools學習,也會使用vsCode開發環境" b = a.replace('dumb','weird') print (a) print (b) print ('幾個很?', a.count('很')) print ('很在0,1..位置', a.find('很')) print ('很在0,1..位置', a.rfind('很')) print ('a的長度',len(a)) print('英文大寫',a.upper()) print('英文小寫',a.lower()) txt = "HELLO,將第一個字母轉成大寫。" x = txt.capitalize() print (x) print (txt.casefold()) y = txt.center(30) print(txt.center(30)) print(y) print(len(y)) w3school字串方法列表 https://www.w3schools.com/python/python_ref_string.asp 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 ...

李政翰金融市場158至170數學符號輸入Math

圖片
  金融市場常識題庫158至163 金融市場常識題庫164至170 除權息參考價數學表達 除權前一天60除息+3元現金股利的開盤參考價 除權息前一天價值=除權息當天價值 60=3+x⇒x=57 除權前一天60除權2元的開盤參考價 除權息前一天價值=除權息當天價值 60=(1+ 2 10 )x=1.2x⇒x= 60 1+0.2 =50 除權前一天60除權2元股票股利+2元現金股利的開盤參考價 除權息前一天價值=除權息當天價值 60=3+(1+ 2 10 )x=1.2x⇒x= 60-3 1+0.2 =47.5 整戶信用交易為持續數學表達 融資維持率= 融資股票當時價值 融資金額 例如,自備4萬元,融資6萬元,融資買10萬元的股票,成交後的維持率 融資維持率= 100 60 =167% unicode表達 區塊division ⇐ ⇒ ⇐  融資股票當時價值 融資金額

爪哇Java輸入繪圖函式庫繪製options到期日損益圖

圖片
  加入控制字串字型font指令 g2.setFont(new Font("monospaced", Font.BOLD, 20)); 心得 程式語言編寫,需要編譯器compiler或直譯器interpreter執行。 瀏覽器Chrome或Edge是HTML, CSS, JavaScript的直譯器。 JAVA語言的編譯器是JDK, Java Development Kit爪哇開發工具。 VS Code是撰寫程式的整合開發環境IDE, Integrated Development Environment,可以編寫程式碼,也可以編譯程式,但需要裝Java延伸套件Extension Pack for Java