- list=[2004,6,22,2005,2,5]
- print("Unsorted: ", list)
- list.sort()
- print("From least to Greatest:", list)
- list.reverse()
- print("From Greatest to Least: ", list)
- print("Numer of Elements: ", len(list))
- list. pop(5)
- print("After Deleting one Element: ", list)
- list. pop(2)
- print("After Deleting two Elements: ", list)
- list. append(9)
- list.sort()
- print("After Adding a new Element: ", list)
- list. append(23)
- list.sort()
- print("After Adding two new Elements: ", list)
- list. pop(1)
- print("After Deleting one Element: ", list)
- list. pop(0)
- print("After Deleting two Elements: ", list)
- list.insert(0,3)
- print("After Adding a new Element: ", list)
- list.insert(1,4)
- list.sort()
- print("After Adding a new Element: ", list)
複製代碼 |