Given a string s = "Leonhard Euler", I need to find if an element in my surname array is a substring of s. For example:
s = "Leonhard Euler"
surnames = ["Cantor", "Euler", "Fermat", "Gauss", "Newton", "Pascal"]
if any(surnames) in s:
print("We've got a famous mathematician!")
anyworks. Tryif any(surname in s for surname in surnames):if any(x in s for x in surnames)? keep in mind that this would pass'Eu'to also count as true. Better idea is to split your name into individual names and match exact words.