For example My string is 'I love you' characters are 'z' 'p' 'q' 'l'
It should return true because 'I love you' contains 'l'
You can convert both the strings to a set and check if there are any common chars by finding intersection
>>> set('I love you') & set('zpql')
{'l'}
>>> bool(set('I love you') & set('zpql'))
True
You can use any
to do a lazy evaluation.
my_string = 'I love you'
characters = ('z', 'p', 'q', 'l')
print(any(letter in my_string for letter in characters))
Will print True if any of the letters in characters
are contained in my_string