Python Programming
About Lesson

List items can be accessed using their index values. List items are identified with positive and negative indices where positive index starts from 0 from left to right while negative index starts from -1 from right to left.

Example
fruitList = [“watermelon”, “banana”, “papaya”]
print(fruitList)

Accessing Values in Lists
The items of the list can be accessible with the help of their positive or negative indices.

#Example
fruitList = [“watermelon”, “banana”, “papaya”]
print(fruitList[2])

#Example
L1 = [‘Maths’, ‘Science’, 1993, 2000];
numList = [1, 2, 3, 4, 5 ];
print (“L1[0]: “, L1[0])
print (“numList[1:3]: “, numList[1:3])
print(thislist[-1])

You cannot copy content of this page