利用w3schools練習的python指令
animal = ["豬", "牛", "羊", '貓']
#python語言的註解comments
x = animal.copy()
print(animal)
x.reverse() #將x反轉reverse
print(x)
animal.append('狗')
print(animal)
y = animal.copy()
y.reverse() #將x反轉reverse
print(y)
Python | 說明或範例JavaScript |
len() | len(list) # 串列 list 長度 | list.length; |
append() | list.append(’ 加元素’) | list.push(’ 加元素’) |
clear() | list.clear() # 移除所有元素 | |
copy() | a = list.copy() # 拷貝至新串列 a | |
count() list.clear() # 移除所有元素
list.count(’ 豬頭’) #list=[’ 豬頭’,...]?
|
extend() list.extend([’ 豬頭’,’ 狗屎’])# 合併 (延伸) 串列
a=list.concat([’ 豬頭’,’ 狗屎’])
|
index()
|
insert()
list.index(’ 豬頭’) # 元素第一次出現的位置 0, 1, 2... list.indexOf(’ 豬頭’)
list.insert(k,’ 豬頭’)# 位置 k 前插入元素’ 豬頭’
|
pop()
list.pop(k) # 移除位置 k 元素
|
remove() list.remove(’ 豬頭’) # 移除第一次出現的’ 豬頭’
reverse() | list.reverse()# 將元素次序反轉
list.slice(k,k + 1) list.reverse()
|
sort() list.sort()# 將元素排序 | list.sort() |
GOOGLE COLAB執行程式
嵌入EMBED影片與網頁
https://lin-yujing.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://sincewayne.blogspot.com/2025/03/202534python-array.html
回覆刪除https://www.w3schools.com/python/trypython.asp?filename=demo_default
回覆刪除https://chenyenhsun.blogspot.com/2025/03/pythonarraylist.html
回覆刪除https://gbsddik.blogspot.com/2025/03/python.html
回覆刪除https://mumeng-ru.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://huutingyu.blogspot.com/2025/03/h1background-colorpurplecolorwhitepaddi.html
回覆刪除https://draft.blogger.com/blog/post/edit/4336680755326581508/5015279057378528774
回覆刪除https://chiuerya0515.blogspot.com/2025/03/34.html
回覆刪除https://xu-bing-wei-0804.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://zyixnn.blogspot.com/2025/03/34.html
回覆刪除https://takuto20050803.blogspot.com/2025/03/python-array.html
回覆刪除https://jiachiangkuo.blogspot.com/2025/03/34.html
回覆刪除https://xu-bing-wei-0804.blogspot.com/2025/03/animal-pythoncomments-x-animal_3.html
回覆刪除https://zhang-1108.blogspot.com/2025/03/34.html
回覆刪除https://chinenkohana.blogspot.com/2025/03/blog-post.html
回覆刪除https://yimignsocool.blogspot.com/2025/03/blog-post.html
回覆刪除https://huuiiiiman.blogspot.com/2025/03/202534python-array.html
回覆刪除https://slu804387.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://yuweiiiiiiiiiiii.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://vovo8564513.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://christina-lqw.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://takming123.blogspot.com/2025/03/202534python-array.html
回覆刪除https://zyixnn.blogspot.com/2025/03/h1background-colorpinkcolorwhitepadding.html
回覆刪除https://zhuo-1005.blogspot.com/2025/03/blog-post.html
回覆刪除https://lu-cheng-yin-2024.blogspot.com/2025/03/34.html
回覆刪除https://pei940922.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://xuan-ang.blogspot.com/2025/03/python-array.htm
回覆刪除https://chan0528.blogspot.com/2025/03/animal-pythoncomments-x-animal.html
回覆刪除https://sccabout.blogspot.com/2025/03/202534python-array.html
回覆刪除作者已經移除這則留言。
回覆刪除https://d11117315111.blogspot.com/2025/03/202534python-array.html
回覆刪除https://yangyoyo0125.blogspot.com/2025/04/202534python-array.html
回覆刪除https://d11117242.blogspot.com/2025/04/htmlcssjavascriptjavapython.html
回覆刪除