List Methods: append(), extend(), and pop() in Python


Modify lists with these common methods.

Source Code

my_list = [1, 2, 3]
my_list.append(4)  # [1, 2, 3, 4]
my_list.extend([5, 6])  # [1, 2, 3, 4, 5, 6]
my_list.pop()  # Removes and returns the last item
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments