List
Python List
Lists are built-in data types that store a collection of ordered values. It’s one of the most flexible, used python data type.
Features that list have
-
Mutable: Lists are mutable, it’s elements can be modified after after the list has been created.
-
Ordered: The order in which the elements where added is maintained
-
Heterogeneous: A list can a contain different data types such as integers, floats, and other data types as well
Creating a list
A list in Python can be created in one of the following ways.
Empty List
An empty list can be created using an empty square brackets []
.
Example
A list with values
To create a list place a sequence of comma-separated values within a square bracket.