Python List extend() method - Syntax & Examples - Add items in a iterable to end of the list

Опубликовано: 01 Июль 2024
на канале: ProgramGuru
68
7

Python List extend() method
In this video, we will learn about extend() method of list object, its syntax, and examples.
extend() method adds all items in a given argument iterable to the end of the list.

Syntax
===========================
The syntax of extend() method is:
list.extend(other)
where other is an iterable whose elements we would like to add to the end of the list.

Consider a list.
When we call extend() method on this list, and pass other as argument.
The extend method, adds the items in the given iterable, to the end of the list.