發表文章

廖思涵.HTML.CSS.JavaScript.Java

圖片
VS code編輯環境截圖 VS code程式碼 from math import * def abc(r): print("廖思涵輸入的半徑 " + str(r)) print("圓面積: "+str(pi*r*r)) print("圓周長: "+str(pi*r*2)) print("球體積: "+str(pi*r*r*r*4/3)) print("球表面積:"+str(pi*r*r*4)) def tri(z): print("廖思涵輸入的度 " + str(y)) print("正弦sin "+str(sin(z))) print("餘弦cos "+str(cos(z))) def group(r, t): abc(r) tri(t) r = float(input("輸入半徑: ")) y = float(input("輸入角度360度單位: ")) t = y/180*pi group(r,t) 說明影片

廖思涵python輸入import數學math函式庫define定義function函數

from math import * #廖思涵math輸入所有函式 # import math #劉任昌輸入math函式庫 def abc(r): #定義函數abc print("圓面積: "+str(pi*r*r)) print("圓周長: "+str(pi*r*2)) print("球體積: "+str(pi*r*r*r*4/3)) print("球表面積:"+str(pi*r*r*4)) def tri(z): print("正弦sin "+str(sin(z))) print("餘弦cos "+str(cos(z))) def group(r, t): abc(r) tri(t) r , t = 1, pi/3 #半徑, 60度=pi/3 group(r,t)

廖思涵期中考VS Code編輯Python圖形使用者介面GUI

圖片
期中考解說 W3schools截圖 VSCode編輯tkinten使用者介面GUI

廖思涵Python字典Dictionaries

圖片
w3scholls截圖 w3scholls練習程式碼 #字典 keys:values, 廖思涵 #w3schools原來 字串:字串,改成 整數:字串 a = { #市場價值最大的五家公司 2330: "台積電", 2317: "鴻海", 2454: "聯發科", 2412: "中華電", 6505: "台塑化" } print(a) print(a[6505]) print(a.get(2330))#功能同 a[2330] print(a.keys()) #keys()方法列出key搜尋鍵 print(a.values()) #keys()方法列出values值 b = a.copy() print("列出b " + str(b)) print(b[2317]) print(b.clear()) a.update({2308: "台達電"}) print(a.values()) print("用迴圈列出字典a的所有值") for t in a: print(a[t]) 字典方法Dictionary Methods Python has a set of built-in methods that you can use on dictionaries. Method Description clear() Removes all the elements from the dictionary copy() Returns a copy of the dictionary fromkeys() Returns a dictionary with the specified keys and value get() Returns the value of the specified key items() Returns a list containing a tuple for each key value pair keys() Returns a list containing the dictionary's keys pop() R...

廖思涵SVG與CANVAS

w3schools練習SVG w3schools練習CANVAS 心得 <svg>svg程式碼</svg> <canvas>canvas程式碼</canvas> <script>網頁JavaScript程式碼</script> ol是order list順序清單, gt大於, lt小於前面加上&控制

廖思涵SVG與CANVAS

w3schools練習SVG 心得 <svg>svg程式碼</svg> <canvas>canvas程式碼</canvas> <script>網頁JavaScript程式碼</script> ol是order list順序清單, gt大於, lt小於前面加上&控制

廖思涵w3school字串str, format, slicing[::]

圖片
#劉任昌strings可以用單引雙引只要對稱 b = '狗吃屎,兔吃菜,貓抓鼠,劉任昌很帥' # 0 1 23 4 5 678 9 10,11,12, print('字串長度' + str(len(b))) #len函數 字串長度 輸出 整數 #str函數 轉成字串 這樣才能串接 print(b[-5:-2]) #練習字串格式format quantity = "精華下午茶" itemno = 5 price = "劉任昌" myorder = "我要吃 {} 吃幾個 {},和 {} 誰一起吃" print(myorder.format(quantity, itemno, price))