A list is a collection that is ordered and changeable. In Python, lists are written with square brackets.
Lists are just like dynamic sized arrays, declared in other languages. Lists do not need to be homogeneous always, which makes it a most powerful tool in Python.
A single list may contain DataTypes like Integers, Strings, as well as Objects.
Lists are mutable, and hence, they can be altered even after their creation.
Program code:
Output:
{1, 2, 3, 4, 5, 8, 13}
In the above code snippet basic functions of list are demonstrated.
To view all the lessons in chapter 9: http://computertutor.in/class-12-computer-science/chapter-9/
To view entire class 12 computer science study material: http://computertutor.in/resources/
You cannot copy content of this page