Python List Example | Combine Two Lists

This python example will show us two methods for combining two python lists.

Method 1: use +

For example:

list1 = [ 'apple', 'orange' ]
list2 = [ 'pineapple', 'blueberry' ]

combined = list1 + list2

print( combined )

Then we will get:

['apple', 'orange', 'pineapple', 'blueberry']

Method 2: use list extend() function

For example:

list1 = [ 'apple', 'orange' ]
list2 = [ 'pineapple', 'blueberry' ]

list1.extend( list2 )

print( list1 )

We also will get:

['apple', 'orange', 'pineapple', 'blueberry']