- # -*- coding: utf-8 -*-
- """
- Created on Fri Jan 24 10:12:20 2025
- @author: student
- """
- list=[12,-3,-50,32,25,11,99,99]
- print(f"原本的list={list}")
- list.append(56)
- print(f"append後的list={list}")
- list.insert(2,999)
- print(f"insert後的list={list}")
- list.pop(0)
- print(f"pop後的list={list}")
- list.remove(99)
- print(f"remove後的list={list}")
- print(f"原本的list={list}")
- list.sort(reverse=1)
- print(f"sort後的list={list}")
- list=[12,-3,-50,32,25,11,99,99]
- print(f"原本的list={list}")
- list.reverse()
- print(f"reverse後的list={list}")
複製代碼 |