python list search value code example
Example 1: python find item in list
>>> ["foo", "bar", "baz"].index("bar")
1
Example 2: python search list by value
[1,2,3].index(2) # => 1
[1,2,3].index(4) # => ValueError
>>> ["foo", "bar", "baz"].index("bar")
1
[1,2,3].index(2) # => 1
[1,2,3].index(4) # => ValueError