黃柏諺python集合set串列或清單list字典dictionary元組tuple
h1>w3schools練習截圖 w3schools程式碼 #黃柏諺 集合{},字典{key:value,},元組(),清單] s= {"台積電", "鴻海", "聯發科"} t= ("台積電", "鴻海", "聯發科") list= ["台積電", "鴻海", "聯發科"] d= {2330:"台積電",2317:"鴻海",2454:"聯發科"} print("型態" + str(type(s)) + str(s)) print("型態" + str(type(t)) + str(t)) print("型態" + str(type(d)) + str(d)) print("型態" + str(type(list)) + str(list)) #字串與字串才能+所以要用str轉成字串 i = 0 for a in list: i = i+1 print("台灣第" + str(i) + "大的公司是") print(" " + a) '''大區域註解用三個引號set集合沒有順序unordered, 練習使用迴圈輸出集合內的內容''' w3schools集合方法 Python has a set of built-in methods that you can use on sets. Method Description add() Adds an element to the set clear() Removes all the elements from the set copy() Returns a copy of the set difference() Returns a set containing the difference between two or more sets differen...