List Methods
| Method | Description |
|---|---|
append(x) | Add item at end |
extend(iterable) | Add all items |
insert(i, x) | Insert at index |
remove(x) | Remove first matching value |
pop([i]) | Remove and return item |
clear() | Remove all items |
index(x) | Index of value |
count(x) | Count occurrences |
sort() | Sort in place |
reverse() | Reverse in place |
copy() | Shallow copy |
Example
nums = [3, 1, 2]
nums.sort()
nums.append(4)
print(nums)