劉任昌python陣列array
w3schools截圖
w3schools程式碼
#劉任昌陣列
#for x in 'Takming gold': # 第一个实例
# print("當前字母: %s" % x)
fruits = ['台積電', '鴻海', '聯發科']
for x in fruits: # 第二个实例
print ("最大公司水果: %s" % x)
print ("練習陣列的11個內建方法")
fruits.append("中華電") #append加元素
fruits.clear()
fruits = ['台積電', '鴻海', '聯發科', '中華電']
print(fruits)
pig = fruits.copy()
print("輸出pig=fruits.copy()結果" + str(pig))
cat = fruits
print("輸出cat=fruits的結果"+str(cat))
fruits.extend(fruits) #extend尾巴+陣列, append加元素
print("extend的 "+str(fruits))
print("copy 的 "+str(pig))
print(" = 的 "+str(cat))
print(fruits.count("台積電"))
fruits.insert(1,"富邦金")
print(fruits)
print(fruits.index("富邦金"))
fruits.reverse()
print(fruits)
fruits.sort()
print(fruits)
fruits.remove("富邦金") #拿走富邦金
print(fruits)
fruits.pop(2) #拿走012的2
print(fruits)
#體會到只要我有耐心與興趣,我也可以當一個專業的程式開發人員
w3schools陣列方法
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 |
https://michael-hou.blogspot.com/2023/04/pythonarray.html
回覆刪除https://xylia-lin.blogspot.com/2023/04/appendcopyw3schools.html
回覆刪除https://tonyzhuang1.blogspot.com/2023/04/pythonarray.html
回覆刪除https://takmingg.blogspot.com/2023/04/pythonarray.html
回覆刪除作者已經移除這則留言。
回覆刪除https://takmingd11117330.blogspot.com/2023/04/pythonarray.html
回覆刪除https://danny1219.blogspot.com/2023/04/pythonarray.html
回覆刪除https://chen-yu-hsi.blogspot.com/2023/04/pythonarray.html
回覆刪除https://hsupppppp.blogspot.com/2023/04/pythonarray.html
回覆刪除https://meishiuanlin.blogspot.com/2023/04/pythonarray.html
回覆刪除https://erichtml-css-javascript-java.blogspot.com/2023/04/blog-post.html
回覆刪除https://ling-cls.blogspot.com/2023/04/pythonarray.html
回覆刪除https://www.blogger.com/blog/post/edit/preview/5683775077331287445/4053840617514450398
回覆刪除https://purplefish-ouo.blogspot.com/2023/04/h1background-color-blue-color-white.html
回覆刪除https://steven0918.blogspot.com/2023/04/httpshtml-css-javascript-java.html
回覆刪除https://d11117331.blogspot.com/2023/04/d1117331python-arrays-2023410.html
回覆刪除https://html-css-javascript-html.blogspot.com/2023/04/pythonarray.html
回覆刪除作者已經移除這則留言。
回覆刪除作者已經移除這則留言。
回覆刪除https://www.blogger.com/blog/post/edit/8406171805557929817/1300033939721246172?hl=zh-TW
回覆刪除https://kuanhtml-css-javascript-java.blogspot.com/2023/04/pythonarray.html
回覆刪除https://guixiu1485.blogspot.com/2023/04/pythonarray.html
回覆刪除https://tinggggggggggg.blogspot.com/2023/04/pythonarray.html
回覆刪除https://winnie032879.blogspot.com/2023/04/pythonarray.html
回覆刪除https://sand456.blogspot.com/2023/04/pythonarray.html
回覆刪除https://1321354312321.blogspot.com/2023/04/h1background-color-purple-color-white.html
回覆刪除https://html-css-javascript-javatang.blogspot.com/2023/04/pythonarray.html
回覆刪除https://python11117312.blogspot.com/2023/05/h1background-colorccddff-color-white.html
回覆刪除