ReferenceList methods
list.extend()
Adds each item from an iterable to the end.
Signature
items.extend(iterable)Parameters
| Name | Means |
|---|---|
iterable | whose items are added one by one |
Returns
None.
Example
Python
a = ["Ada"]
a.extend(["Grace", "Kat"])
print(a)
b = ["Ada"]
b.append(["Grace", "Kat"])
print(b, len(b))Output
['Ada', 'Grace', 'Kat'] ['Ada', ['Grace', 'Kat']] 2