appending list index python code example
Example 1: append to lists python
list = ['a', 'b', 'c', 'd']
print list[1:-1] ## ['b', 'c']
list[0:2] = 'z' ## replace ['a', 'b'] with ['z']
print list ## ['z', 'c', 'd']
Example 2: how to add an item to a list python
numbers = [1, 2, 3, 4]
numbers.append(10)
print(numbers)