safe_index(items, target) that returns the index of the first occurrence of target in items, or -1 if target is not found. Do not let an exception propagate.items = ['a', 'b', 'c'], target = 'b'
1
'b' is at index 1.
items = ['a', 'b'], target = 'z'
-1
'z' is not present.
.index() raises ValueError when missing — check with `in` first, or wrap it in a try/except.