Check sibling questions

The data type list is an ordered sequence which is mutable and made up of one or more elements.

  • A list can have elements of different data types , such as integer, float, string, tuple or even another list. 
  • A list is very useful to group together elements of mixed data types. 
  • Elements of a list are enclosed in square brackets and are separated by comma. 
  • Like string indices, list indices also start from 0.

Accessing elements in a List

The elements of a list are accessed in the same way as characters are accessed in a string. 

The list items are accessed by referring to the index number in square brackets. 

 

 

Lists are Mutable

In python, lists are mutable ie.,  the contents of the list can be changed after it has been created.

  1. Computer Science - Class 11
  2. Chapter 9 Class 11 - Lists

About the Author

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo