Lists are used to store multiple items in a single variable. Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are tuples, sets and dictionary, all with different qualities and usage.
Lists are created using square brackets [ ]. List are mutable. It is just like dynamic sized arrays.
List can be defined as a collection of values or items of different types. It does not need any built in function for its creation. It can contain duplicate values with their distinct positions.
list_1=[1,2,3,4,5,6]
Size of List:
In Python, we can simple get to know the size of any given list with the help of code.
List2=[5,10,20,25,30]
print(len(List2))
Output: 5
Characteristics
- The lists are ordered.
- The element of the list can access by index.
- The lists are the mutable type.
- The lists are mutable types.
- A list can store the number of various elements.