title: List Extend Method
List Extend Method
There are many methods for lists, you can explore all of them by typing
help(list) in your python console.
One of them is the extend function which, as the name says extends the list by adding all items of a list (passed as an argument) to the end.
cities = ["San Francisco", "Los Angeles", "New York"] cities_in_texas = ["San Antonio", "Austin", "Dallas"] cities.extend(cities_in_texas) print(cities)
["San Francisco", "Los Angeles", "New York", "San Antonio", "Austin", "Dallas"]
The official documentation for
extend() can be found here