bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Foundations
Python•Foundations

Python - Join Lists

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Python - Join Lists?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ = ["a", "b", "c"]
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Another way to join two lists is by appending all the items from list2 into list1, one by one:
One of the easiest ways are by using the + operator.
There are several ways to join, or concatenate, two or more lists in Python.

Join Two Lists

There are several ways to join, or concatenate, two or more lists in Python.

One of the easiest ways are by using the + operator.

Example

list1 = ["a", "b", "c"]
list2 = [1, 2, 3]
list3 = list1 + list2

print(list3)

Another way to join two lists is by appending all the items from list2 into list1, one by one:

Example

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

for x in list2:
  list1.append(x)
  print(list1)

Or you can use the extend() method, where the purpose is to add elements from one list to another list:

extend()

Previous

Python - Copy Lists

Next

Python - List Methods