What is a List?
- The list is one of the most common collection datatypes in Python which is ordered and mutable (changeable).
- It is used to store a group of an element together in a sequence.
- A list can store both homogenous and heterogeneous elements i.e., a single list may contain data types like integers, floats, strings as well as objects.
- Individual value in a list is called an element.
- These elements will be stored in a contiguous memory location.
- For Ex:
- Number1 = 10,
- Number2 = 20,
- Number3 = 30,
- Number4 = 40
- These individual variables can be represented in a list as
- Number_list = [ 10, 20, 30, 40 ]