List Methods in Python
List Methods in Python
-BY
24B81A05MB
Introduction to Lists:
1.Lists are sequence data type
2.Lists are ordered
3.Mutable collections of items in Python.
4.Can store elements of different data types.
5.Defined using square brackets: e.g., my_list = [1, 2, 'apple', 4.5]
Common List Methods:
• append() – Add an element to the end of the list
my_list = [10, 20, 30]
my_l ist.append(40) # [10, 20, 30, 40]
extend():
Adds elements from another iterable (like a list) to the end of the current list.
TQ