Introduction
A list is an in-built Python data structure that can be changed. It is an ordered and changeable collection of elements. By ordered sequence, it is meant that every element of the list can be called individually by its index number.
Some of the important points about the list are:
- The list can be created by placing all elements inside a square bracket [].
- All elements inside the list must be separated by a comma “,”.
- It can have any number of elements and the elements need not be of the same type. So, we can also say that it is a collection of heterogeneous data types.
- Lists index always starts from 0, so if the length of a string is “n”, then the last element will have an index of n-1.
- Lists are mutable therefore they can be modified after creation.
- An Empty List is denoted as L[ ].

LIST METHODS

Let us understand each method.
INDEX
This method returns the index of the specified elements. It takes one argument. If the element specified is not present, it generates an error.
- l= [7,4,2,6,9,1,5]
- a= l.index(9)
- print(“Number found at”,a) # will return 4
The output of the following code is shown below.

It returns the index of the first and only occurrence of specified element. If you want to specify a range of valid index, you can indicate the start and stop indices.
- l= [7,4,9,2,6,9,1,5,4,9]
- a= l.index(9)
- print(“Number found at”,a) # will return 2





Onkar SharmaPosted Oct 6, 2019, 5:36 AM
Very informative article... ..
Sanjit Kumar SinghPosted Jul 15, 2019, 5:18 AM
Awesome Article .
Atul GuptaPosted Jul 15, 2019, 12:32 AM
Knowledgeable, thanks for sharing!
Amit KumarPosted Jul 15, 2019, 12:02 AM
Nice Article..
Gaurav GahlotPosted Jul 14, 2019, 11:06 PM
Welcome to the Community Aashina. Keep up the good work. :)
Rajanikant HawaldarPosted Jul 12, 2019, 9:58 AM
nice article thanks for sharing
Mahesh VermaPosted Jul 12, 2019, 8:16 AM
Nice article....keep it up