find item in list

>>> ["foo", "bar", "baz"].index("bar")

Here is what the above code is Doing:
1. We’re creating a list of strings.
2. We’re using the index() method to find the index of the string “bar”.
3. We’re printing the index of “bar”.

The index() method returns the index of the first occurrence of the given element.

If the given element is not found, the index() method returns -1.