Introduction
This article is focusing and discussing about list in Python programming language. Basically, list is one of the data type available in Python programming language. In order to see all of the available data type in Python programming language, just check this link. That is an article with the title of ‘Data Type in Python’. But in this article, the focus will be just on the list as one of the data type available in Python programming language. List is actually not a simple data type. Instead, it is a collection data type which has a certain data structure. As a collection data type with a certain data structure, it can store multiple data in a certain way.
List Characteristics
In this part, the focus will be on the characteristics of list as one of the data type available in Python programming language. So, what are the characteristics of list which exist as one of collection data type in Python programming language :
-
Number of data.
First of all, it can contain multiple data or collections of data. For this characteristic, it is obvious that this data type allow to store more than one data. For an example as follows : [1,2,3,4,5,6].
-
Data types.
Next, in the addition of the ability for storing multiple data, each data can also have different data types. About this characteristic, the explanation for it has been already available in another article. It is an article with the title of ‘Data Type in Python’ in this link. In short, it can contain any data with any data types ranging from Boolean, String, Integer, Float, etc. For an example : [True,’Mark’,”Stockholm”,98,734.917].
-
Mutability.
Another characteristic, it is possible to change the data. The changes include in the value of the data and also the sequence of the data. In some specific term, it is a characteristic which is called ‘mutable’. In other words, it can mutate or it can change along the way.
-
Initialization or Definition Format.
For list, in order to initialize it, it is using square bracket. In order to declare, define an element which is using list data type, it is using a square bracket as in the following example :
list_example = []
-
Data Duplication.
Another character for the list, it can contain duplicate data. As further explanation, in terms of duplicate data, list can contain the exact same data as many as it can. For an example : [1,1,1,1,True,True, 0,0,’Japan’,”Japan”,2.0,2.0,3.0,3.0].
2 thoughts on “List in Python”