If you don’t care where the matching element is, then use:
found = x in somelist
If you do care, then use a LBYL style with a conditional expression:
i = somelist.index(x) if x in somelist else None
If you don’t care where the matching element is, then use:
found = x in somelist
If you do care, then use a LBYL style with a conditional expression:
i = somelist.index(x) if x in somelist else None