返回列表 發帖
回復 1# 鄭繼威


   # a=[33,45,51,"hello",True,33]
# print(len(a))
# a.insert(1,36)
# a.append(42)
# print(a)
# temp=a.pop(1)
# print(temp)
# find=a.index(33,2)
# a.pop(find)
# print(a)
a=[1,2,3,4,8,4,9,2]

a.sort()
a.reverse()
print(a)

TOP

list=[12,-3,-50,32,25,11]
print("排序前:",list)
list.sort()
print("排序後(遞增):",list)
list.reverse()
print("排序後(遞減):",list)
print("元素數量:",len(list))
list.pop()
print("pop掉一元素",list)
list.append(-20)
print("append一元素",list)
list.insert(4,0)
print("insert一元素",list)

TOP

返回列表