xxxxxxxxxx
>>> list1 = [[10,13,17],[3,5,1],[13,11,12]]
>>> list1[0][2]
17
xxxxxxxxxx
butterfly_life_cycle = ["egg", "larva", "pupa", "butterfly"]
print(butterfly_life_cycle.index("egg"))
print(butterfly_life_cycle.index("larva"))
print(butterfly_life_cycle.index("pupa"))
print(butterfly_life_cycle.index("butterfly"))
# output:
# 0
# 1
# 2
# 3
xxxxxxxxxx
Python Program to Find the index of element in the list
# Programming list
programming_list = ['C','C#','Python','Java','JavaScript','SQL']
# find the index of Python
index = programming_list.index('Python')
print('The index of Python is :', index)
# find the index of SQL
index = programming_list.index('SQL')
print('The index of SQL is :', index)
xxxxxxxxxx
list_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
element = 3
list_numbers.index(element)
xxxxxxxxxx
# Make the list
list = ['bananas', 'apples', 'watermellon']
# Print the word apples from the list
print(list[1])
xxxxxxxxxx
ValueError: 'item' is not in list
# Programming list
programming_list = ['C','C#','Python','Java','JavaScript','SQL','Java','F#','Go']
# find the lowest index of HTML
index = programming_list.index('HTML')
print('The index of HTML is :', index)