Python List#
In Python, a list is an ordered and mutable collection of data.
A list can contain items of various data types, and the items can be modified, added, or deleted.
Let’s assume we need to handle 10,000 values.
Creating 10,000 variables would be highly inefficient.
Therefore, Python provides lists to efficiently handle multiple values.
1. Creating a List#
A list can be created using [ ] as follows.
You can place multiple values inside the [ ] to handle them as a single list.
In the following example, integers, floats, and strings are all included in a single list.
An important feature is that a single list can contain multiple data types.
Each value contained in a list is called an element.