Answers for "oython index of list"

1

what is index in list in python

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
Posted by: Guest on December-02-2021
1

how to find index of list of list in python

[(i, colour.index(c))
 for i, colour in enumerate(colours)
 if c in colour]
Posted by: Guest on August-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language