Adding Elements to the End of a List in Python
To add elements to the end of the list, you can use the append method. We pass the element we need to the method parameter:
lst = ['a', 'b', 'c']
lst.append('d')
print(lst) # ['a', 'b', 'c', 'd']
After applying the method, we will see that our original list has changed.
Given a list:
lst = [1, 2, 3, 4, 5]
Add one more element to the end of it.
Given a list:
lst = []
Add to it the number 1.
Given a list:
lst = []
Fill it in with the following lines: 'a', 'b', 'c'.