發表文章

蔡淑貞整合開發環境IDE的Jupyter編輯Python程式碼

圖片
SPYDER程式碼 程式碼 from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 banks=['摩根大通','美國銀行','中國工商','富國銀行','匯豐銀行','巴黎銀行'] def ABC(): #畫圖 define自訂函數 global b1 #宣告b1是廣域GLOBAL變數,其他函數也可使用 txt = '' for i in range(len(banks)): txt += banks[i] + ' ' b1=Label(canvas,text=txt,font='Arial 20 bold') b1.pack(side=TOP) def XYZ(): #清除視窗的all所有canvas圖 banks.append('三菱銀行') banks.append('台灣銀行') ABC()#結束XYZ之前給它顯示 def kill(): b1.pack_forget() tk = Tk() tk.title("賴青德python建立tkinter視窗使用者介面") #也可以定義視窗名為 window, root課本都如此習慣 canvas = Canvas(tk, width=400, height=400) canvas.pack() btn1 = Button(tk, text="賴青德銀行", command = ABC, bg='black',fg='white').pack(side=LEFT) btn2 = Button(tk, text="賴青德增加", command = XYZ).pack(side=LEFT) btn3 = Button(tk, text="賴青德刪除", command = kill).pack(side=LEFT) tk.mainloop()

蔡淑貞Javascript與Python比較

圖片
全球市場價值最大的銀行 按鈕PUSH增加 按鈕POP執行自訂函數kill 按鈕POP執行kill呼叫其他函數 CSS也可以in-line 寫在這裡成為網頁的一部分,執行後,可以看到。function kill_SHOW執行二指令 banks.pop()指令移除banks串列的最後一個元素ABC()去執行函數ABC()。P代表paragraph段落

蔡淑貞

.SELECTOR{用在多個元素},SPAN拇指與小指的距離,一小段,一小段的文字 UL=UNDERER LIST, OL=ORDERED LIST, LI=LIST push推,美國餐廳放置餐盤的架子下面是彈簧,取盤子pop,放入盤子push append附加在後面, appendix書本的附錄 大括號{ }CURLY BRACKET, CURLY捲,用於PYTHON集合 中括號[ ]SQUARE BRACKET, SQUARE方形,用於PYTHON串列 小括號( )CIRCLE BRACKET, CIRCLE圓,用於PYTHON元組 角括號 CORNER BRACKET,不能直接打角括號,因為它們是HTML命令,需用&符號接LT(小於Less Then)再分號; 圓周CIRCUMFERENCE, 直徑DIAMETER, 半徑RADIUS BORDER邊界, SOLID實心, PX=PIXEL點 PYTHON與JAVASCRIPT命令的對照,PYTHON必須透過編輯器或雲端伺服器(例如GOOGLE COLAB)執行,JAVASCRIPT可以直接在瀏覽器CHROME或EDGE執行 PYTHON指令len(串列)對比JAVASCRIPT串列.length; PYTHON指令串列.append(新增)對比JAVASCRIPT串列.push(新增); 執行JAVASCRIPT的串列迴圈:全球市場價值最大的銀行 全球市場價值最大的銀行 按鈕BUTTON push

蔡淑貞PYTHON陣列ARRAY串列

圖片
利用W3SCHOOLS練習PYHON指令 animal = ["豬", "牛", "羊", '貓'] #python語言的註解comments x = animal.copy() print(animal) x.reverse() #將x反轉reverse print(x) animal.append('狗') print(animal) y = animal.copy() y.reverse() #將x反轉reverse print(y) GOOGLE COLAB執行程式 嵌入EMBED影片與網頁

蔡淑貞計算機

圖片
計算機 1 2 3 + 4 5 6 - 7 8 9 * 0 C = / 教學影片 維基百科 python array陣列的方法 Array Methods Python has a set of built-in methods that you can use on lists/arrays. Method Description append() Adds an element at the end of the list clear() Removes all the elements from the list copy() Returns a copy of the list count() Returns the number of elements with the specified value extend() Add the elements of a list (or any iterable), to the end of the current list index() Returns the index of the first element with the specified value insert() Adds an element at the specified position pop() Removes the element at the specified position remove() Removes the first item with the specified value reverse() Reverses the order of the list sort() Sorts the list python array方法撰寫模式貼上 Array Methods Python has ...

蔡淑貞期末考Math.PI與Math.E放入計算機

蔡淑貞學習Bro code製作計算機 + 7 8 9 - 4 5 6 * 1 2 3 / 0 . = 刪 ** PI E https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes!

蔡淑貞計算機

圖片
蔡淑貞學習Bro code製作計算機 disply的vlue用eval(display.value) disply的vlue用eval(display.value)取代,算是「字串」運算結果 eval()內建函數(方法) in-line線內設定樣式 唯讀 read only + 7 8 9 - 4 5 6 * 1 2 3 / 0 . = 刪 蔡 淑 貞 https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes! 心得與考試重點 LIST條例,UL=UNORDERED LIST,OL=ORDERED LIST,BUTTON按鈕,CLICK按下,ONCLICK事件 網頁的命令大小寫都可以 刪 <button onclick=="clearDisplay()">刪</button> SCRIPT區段有三個自訂的函數 function appendToDisplay(input) { const display = document.getElementById("display"); display.value += input;} function clearDisplay() { const display = document.getElementById("display"); display.value = "";} function calculate() { const display = document.getElementById("display"); try{ display.value = eval(display.value); } catch(error){display.value = "Error";} } 在STYLE區段定義.MY{BACKGRO...