Skip to main content

Join Two Lists

Python gives you several ways to combine, or concatenate, two or more lists.

The + operator is among the simplest.

Example

Combine two lists with +:

Prompt
Write a Python program that creates two lists: list1 with "a", "b", "c" and list2 with 1, 2, 3. Join the two lists using the + operator and print the result.
Output: complete Python program

Example

Add list2 to list1 item by item:

Prompt
Write a Python program that creates two lists: list1 with "a", "b", "c" and list2 with 1, 2, 3. Append all items from list2 into list1 one by one using a for loop and print list1.
Output: complete Python program

Example

Let extend() add list2 to the end of list1:

Prompt
Write a Python program that creates two lists: list1 with "a", "b", "c" and list2 with 1, 2, 3. Use the extend() method to add list2 at the end of list1 and print list1.
Output: complete Python program