發表文章

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

胡恩誠期中考VS Code編輯Python圖形使用者介面GU

圖片
期中考 解說 題目 # 集合{},字典{key:value,},元組(),清單或陣列[] p = ("台積電", "鴻海", "聯發科") r = {"台積電", "鴻海", "聯發科"} s = ["台積電", "鴻海", "聯發科"] t = ["中華電", "台塑化", "台達電"] d= {2330:"台積電",2317:"鴻海",2454:"聯發科"} u = s v = s.copy() s = s.extend(t) print(u) print(v) print(len(d)) i = 0 for a in p: #然後嘗試取代p為r,s,t,u i = i+1 print("台灣第" + str(i) + "大的公司是") print(" " + a) w3schools 微軟VS Code編輯Python圖形使用者介面 Python程式碼 from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 from math import * #從函式庫 math 輸入所有 * 方法 t = (3,4,5,6,7,8,9,10,11,12,16,20, 32) #宣告一元組tuple(...) tk = Tk() tk.title("劉任昌Tkinter程式庫建立GUI") canvas = Canvas(tk, width=500, height=500) canvas.pack() def show(event): #定義由事件event(按鈕選單)呼叫的函數show cx, cy, cr = 210, 210, 200 #宣告圓中心座標cx, cy半徑cr x, y =[],[] ...

胡恩成期中考VS Code編輯Python圖形使用者介面CUI

圖片
期中考複習 # 集合{},字典{key:value,},元組(),清單或陣列[] p = ("台積電", "鴻海", "聯發科") r = {"台積電", "鴻海", "聯發科"} s = ["台積電", "鴻海", "聯發科"] t = ["中華電", "台塑化", "台達電"] d= {2330:"台積電",2317:"鴻海",2454:"聯發科"} u = s v = s.copy() s = s.extend(t) print(u) print(v) print(len(d)) i = 0 for a in p: #然後嘗試取代p為r,s,t,u i = i+1 print("台灣第" + str(i) + "大的公司是") print(" " + a) 影片239 w3schools期中考截圖 微軟VS Code編輯tkinter圖形使用者介面

胡恩誠python陣列array

w3schools陣列方法Array Methods Python有一套內建方法(built-in methods). 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 教學影片