Function Details: extend

Description


Extend the list by appending all the items from the iterable.


Extended Description


The extend() method adds all elements from the given iterable to the end of the list. It modifies the list in-place and doesn't return a new list. This method is more efficient than using multiple append() calls or concatenation when adding multiple elements.


Function Signature



Module: list

Class: list

Parameters



Parameter List


  • iterable: Iterable

Return


This method doesn't return a value. It modifies the list in-place.


Return Type


None

Output

Explanation

This example demonstrates the basic usage of extend(). It adds all elements from the [4, 5] list to the end of lst.