Searching for many different names in a Panda frame
Your code follows this pseudo-code pattern:
if any of these strings are in name:
    do x

The simplest way to express that in Python is to invert the condition:
if name in any of these strings:
    do x

Or as actual Python:
if name in [&quot;Alan&quot;, &quot;Mary&quot;]:
    print(name)