append() and extend() in Python

Last Updated : 16 Feb 2026

In Python, there are two options to join the list which are the append() and extend() methods.

To read more Python List

The append() Method

The append () method is used to add the elements from one list to the end of another list.

Syntax:

To read more Python List append() Method

Example: Appending Elements to the List

Let's see a practical use of the append() method by joining the lists.

Example

Compile and Run

Output:

['We ', 'are', 'learning']
['We ', 'are', 'learning', ['Append', 'Extend', 'in Python']]

Explanation

In the above example, we have used the append() method to add elements to the list. When a list is passed to append(), it does not add each item separately. Instead, it adds the entire list as a single element at the end of the original list.

Using the append() Method with a for Loop

We can use the for loop with the append() method to add the elements from one list to the end of another list.

Syntax:

Here,

  • list1: The list to which elements will be added.
  • list2: The list whose elements will be appended to list1.

Parameter: The method accepts element as parameter. A loop variable that temporarily holds each item from list2 during the iteration.

Return Value: A new list is not returned. The original is modified with new elements from the second list.

Example: Appending List Using for Loop

Let's take an example where we will be using the append() method with the for loop.

Example

Compile and Run

Output:

['MarutiSuzuki', 'Tata', 'Hyundai', 1, 2, 3]

Explanation

In the above example, we have the first list named car and the second list named rank. A for loop is used along with the append() method to add the elements of the rank list into the car. Finally, the updated list is printed, which contains both car names and numbers.

The extend() Method

In Python, the extend() method is used to join or concatenate the elements from one list to the end of another list. It is one of the simplest methods to join distinct lists.

Syntax:

Here,

  • list1: The original list that will be modified by adding elements to it.
  • list2: This list contains the elements that will be added to the end of list1.

Return Value: It does not return any new list.

To read more Extending a List in Python

Example: Extending to a List

Let's see an example, where we will use the extend method to add elements of the second list to the first list.

Example

Compile and Run

Output:

['MarutiSuzuki', 'Tata', 'Hyundai', 1, 2, 3]

Explanation

In the above example, we have used the extend method to add the elements of the second list to the end of the elements of the first list. No new list is created; only the first, or original, list named car is modified by adding the elements from the second list named rank.

Differences Between append() and extend() Method

append()extend()
The append method adds a single element at the end of the list.The extend method adds multiple elements from the second list to the first list.
It accepts a single element of any data type.It accepts multiple data types such as lists, tuples, etc.
It increases the length of the original list by one element.It increases the length of the original according to the number of elements in the second list.
We use the append() method to add only a single item.We use the extend() to add multiple items to the list.
The time complexity is O(1) for adding a single element.In the extend() method, the time complexity is O(k), where k is the number of elements in the second list.

Conclusion

In this tutorial, we learnt that there are two methods to join the elements of distinct list which are the append() and extend() methods. Both methods have different functionalities and use cases, such as the append method, which adds a single element at the end of the list, whereas the extend method adds multiple elements from the second list to the first list. We have used examples, output, and explanation to understand the topic in depth.