Is it possible to use the + operator to add more than two lists?


#1

Question

In this exercise, the + operator is shown adding two lists together. Is it possible to combine more than two lists?

Answer

Yes, the + operator can be used to add more than two lists. It is possible to combine many lists together using the + operator just by adding more elements to the line. The following example shows how the + operator can join multiple lists mixing both variables and explicit lists.

list1 = [10, 20, 30]

list2 = [40, 50, 60]

list1 = list1 + list2 + [70, 80, 90] + [100, 110]