發表文章

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

吳尚豪Python字典Dictionaries

圖片
字典Dictionaries w3schools練習 Dictionary Methods Python has a set of built-in methods that you c an 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() Removes the element with the specified key popitem() Removes the last inserted key-value pair setdefault() Returns the value of the specified key. If the key does not exist: insert the key, with the specified value update() Updates the dictionary with the specified key-value pairs values() Returns a list of all the values in the dictionary
圖片
吳尚豪SVG與CANVAS 心得 W3SCHOOLS練習 心得 CAVAS練習 老師教學影片 1. SVG練習 SVG /SVG 2. CANVAS練習 CANVAS /CANVAS 3. JavaScript練習 Script /Script Canvas element " allowfullscreen> SVG " allowfullscreen>

吳尚豪w3schools字串str, format, slicing[::]

圖片
#吳尚豪的作業 a = "於今日2023年3月6日,第三節" #    01234567891011 12 13 14 #              -7-6-5-4-3-2-1 print(a[2:5]) print(a[-2:-5]) print(a[::-1]) b = a[-2:-7] c = a[::] print(b) print(c) print('字串長度' + str(len(a))) #len函數 字串長度 輸出 整數 #str函數 轉成字串 這樣才能串接 #以下是 format quantity = "倍加能" itemno = "3組" price = "團購" myorder = "今天我想買 {} 大約 {} 跟 {} 一起" print(myorder.format(quantity, itemno, price))