Page 128 - Plus V4 with Adobe class 8
P. 128
CHANGING THE LIST ELEMENT
Lists are mutable, which means the elements of a list can be changed or new elements can be added
to a list by using an assignment operator (=).
To change the elements of a list, follow the program as given below.
On running the above program, you will get the following output:
TRAVERSING A LIST
Traversing means accessing or visiting the elements of a list. Various ways to traverse a list are indexing,
negative indexing and slicing.
Indexing
The index of elements of a list starts from 0; which means if a list contains 10 elements then its index
(it is always an integer number) is from 0 to 9.
Factbot
In case if the user tries to access an element from a list beyond the defined range of the list, then it will give
an IndexError.
To access the list elements, the indexing operator or subscript operator [ ] is used.
If we want to find the elements in the list using the index value, then follow the program as given below.
126 Plus (Ver. 4.0)-VIII

