發表文章

林姿瑋期中考emoji繪文字onchange事件

圖片
林姿瑋輸入參數 輸入k 輸入m 輸入n 執行自訂函數 red green blue 重點 span手掌張開拇指到小指,短橋梁長度。 VSCode是IDE整合開發環境。 CTRL+SHIFT+L一次改全部 Integrated Development Environment alert內建函數,自訂函數abc 利用id加上syle方法是#id 林姿瑋輸出結果

林姿瑋Python自訂函數迴圈write模式a,w,x

圖片
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)         ...

林姿瑋檔案處理

圖片
UTF8 encode編碼 練習程式碼 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()   影片378 影片379

林姿瑋python寫入write迴圈範圍range

圖片
程式碼 space, slash, backslash, cr = ' ', '/', '\\', '\n' k = input('邊長: ') #輸入字串 m = input('橫向: ') k, m = int(k), int(m) f = open("林姿瑋.txt",'w',encoding='utf8') f.write('林姿瑋讀取檔案' + cr)#註解\n換列 for i in range(9):     f.write(str(i)) f.write(cr) for i in range(1, k+1):   #迴圈1到k     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)       ...

林姿瑋python內建函數built-in函數function迴圈loop範圍range

圖片
截圖 程式碼 print(int(10)) print(int("ff",16)) print(int('100',16)) print(int('100',8)) a = [0>1, 2>1, 3==3]#串列list使用square bracket中括號 print("是否all全真",all(a)) print("存在任何any一個真",any(a)) print("林姿瑋bin二進位輸出一到9") for i in range(10): #0 to 9進位1 print(bin(i)) for i in range(0, 200, 10): print(hex(i)) a = ('蘋果', '香蕉', '櫻桃',"durian") b = "Hello World" c = 33 d ={'蘋果', '香蕉', '櫻桃',"durian"} e=['蘋果', '香蕉', '櫻桃',"durian"] print("a元組typle", type(a)) print("b字串", type(b)) print("c整數integer", type(c)) print(type(d), type(e)) w3schools內建函數列表 https://www.w3schools.com/python/python_ref_functions.asp Python has a set of built-in functions. 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 ...

林姿瑋python字串string方法metods

圖片
教學影片371 字串.方法() 函數len(字串) CHR(字串) zfill(20) upper()大寫 lower()小寫 swapcase()大小寫 vs code 與 w3school截圖 程式碼 txt = "林姿瑋Love蘋果,蘋果我my favoritE水果蘋果" print(txt.count("蘋果")) print('先練習內建函數len',len(txt)) print('find',txt.find("蘋果")) print('rfind',txt.rfind("蘋果")) print("print列印,字串string字元character的組合") print(txt.title()) print(txt.lower()) print(txt.upper()) print(txt.swapcase()) print(txt.zfill(32)) print(txt.startswith("林")) print(len(txt)) for i in range(33333, 33344): print(chr(i)) for i in range(65, 70): print(chr(i)) 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 t...

林姿瑋2024/1/8JAVA&課堂心得

圖片
JAVA 心得 數學公式 時事新聞 《紐約時報》告OpenAI及微軟侵權 擅取資源訓練AI求償數十億 影片358 影片362 影片363 影片365 程式語言編寫,需要編譯器compiler或直譯器interpreter執行。 瀏覽器Chrome或Edge是HTML, CSS, JavaScript的直譯器。 JAVA語言的編譯器是JDK, Java Development Kit爪哇開發工具。 VS Code是撰寫程式的整合開發環境IDE, Integrated Development Environment,可以編寫程式碼,也可以編譯程式,但需要裝Java延伸套件Extension Pack for Java