How do I concatenate lists together?


#1

Question

How do I concatenate lists together?

Answer

List concatenation works just like string concatenation - we just make use of the + operator! For example, if we had two lists:

my_first_list = [1, 2, 3]
my_second_list = [4, 5, 6]

I could concatenate them into a single, third list, like this:
my_combined_list = my_first_list + my_second_list


FAQ: Learn Python - Lists and Functions - Using two lists as two arguments in a function