7 Ways To Combine Lists In Python

In this article, I’ll show you 7 different ways to combine lists in Python. I’m sure, there could be many more, but I found these ones the most frequently used ones.

Way 1: Using Extend

list1 = [1,2,3]list2 = [4,5]list1.extend(list2)print(list1) #output ==> [1,2,3,4,5]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store