# list.insert(before, value) list = ["a", "b"] list.insert(1, "c") print(list) # ['a', 'c', 'b'] # at the end: list.append(value) list.append("d") # ['a', 'c', 'b', 'd']
Here is what the above code is Doing:
1. We create a list with two elements, “a” and “b”.
2. We insert the element “c” at index 1.
3. We append the element “d” to the end of the list.