發表文章

目前顯示的是 4月, 2024的文章

陳亮妘emoji期中考select選單onchange事件

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

陳亮妘vs code期中考

圖片
import csv #輸入csv套件comma separated value file = open('SPY.CSV','r') #打開下載的檔案SPY.CSV,模式是r讀取, csvreader = csv.reader(file) #將檔案讀入變數csvreader header, rows = [], [] #宣告空白串列(陣列,清單) header = next(csvreader) #串列header儲存檔案第一列 for row in csvreader: #檔案接續逐列附加append於rows串列 rows.append(row) file.close() #關閉檔案 header.append('MA20') #appendix附錄,為header串列list新曾元素 header.append('部位') #print('印出前十列') #print(header) for i in range(20): rows[i].append(rows[i][5]) for i in range(21,len(rows)): sum20 = 0.0 #實數=浮點數 for j in range(i-20, i): sum20 += float(rows[j][5]) rows[i].append(sum20/20) for i in range(len(rows)-3,len(rows)): #length的命令len(rows) print('第',i+1,'列',rows[i]) file = open('SPYW.CSV','w',newline='') w = csv.writer(file) #寫入檔案 VScode是IDE(程式)整合開發環境 w.writerow(header) #第5列將檔案欄位名稱列header w.writerows(rows) #第7列將檔案...

期中考網頁檔案對照Python寫入

圖片
CSS示範程式碼 { 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 } input { font-size: 24px ; background-color: rgb( 210 , 250 , 215 ) ;} .monkey { font-size: 36px ;} HTML示範程式碼 const space= ' ' , slash= '/' , backslash= '\\' , cr= '\n' ; function row1(k,m){ for ( let i= 0 ; i<k;i++){ for ( let ii= 0 ; ii<m; ii++){ for ( let j= 0 ; j<k-i- 1 ; j++) out+=space; out+=slash; for ( let j= 0 ; j< 2 *i; j++) out+=space; out+=backslash; for ( let j= 0 ; j<k-i- 1 ;j++) out+=space;}; out+=cr;};}; function row2(k,m){ for ( let i= 0 ; i<k; i++){ for ( let ii= 0 ; ii<m; ii++){ for ( let j= 0 ; j<i; j++) out+=space; out+=ba...