Python List index()

PHOTO EMBED

Tue Jan 18 2022 09:08:28 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user]

animals = ['cat', 'dog', 'rabbit', 'horse']

# get the index of 'dog'
index = animals.index('dog')


print(index)

# Output: 1
content_copyCOPY

https://www.programiz.com/python-programming/methods/list/index