append
insert
remove
pop
len
list[start:end]
nums = [10, 20, 30, 40, 50] print(nums[1:4]) # [20, 30, 40]
letters = ["a", "b", "c", "d", "e"] print(letters[:3]) print(letters[2:])
colors = ["red", "green"] colors.append("blue") print(colors) # ["red", "green", "blue"]
[1, 2, 3]
nums = [1, 2, 4] nums.insert(2, 3) print(nums) # [1, 2, 3, 4]
fruits = ["apple", "banana", "cherry"] fruits.remove("banana") print(fruits) # ["apple", "cherry"]
nums = [10, 20, 30] nums.pop() print(nums) # [10, 20]
len()
pets = ["dog", "cat", "hamster"] print(len(pets)) # 3
[5, 10, 15, 20]