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:

pythonlst = ['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.

Задание 1

Given a list:

pythonlst = [1, 2, 3, 4, 5]

Add one more element to the end of it.

Задание 2

Given a list:

pythonlst = []

Add to it the number 1.

Задание 3

Given a list:

pythonlst = []

Fill it in with the following lines: 'a', 'b', 'c'.