What is python list || easiest way to learn python list

What is python list

A python list is a container that contains different Python objects like Integers, String, values. It is same as array in other programing languages. A list can be represented by square brackets. List is mutable hence list can be modified or updates. 

Example :-

[ 10, 20, 5, 15 ]

[ ‘Ajay’, ‘Sachin’, ‘Rohit’ ]

Types of Python List

What is python list., Types of Python List

1. Homogeneous List

If a python list contains the same type of values then it will be called as Homogeneous List.
Example :- 

        [ 5, 7, 4, 10 ]

        [ ‘Raju’, ‘Vipin’, ‘Sanju’]

we can see both list have same types of values respectivily.

2. Heterogeneous List

If a python list contains different types of values then it will be called as Heterogeneous List.
Example :-

        [ 15, 10, ‘Amit’, ‘Raju’ ]

 
        [ ‘Sachin’, ‘Vipin’, ‘Hemraj’, 25 ]
 
Important Links

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.      

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *