I have found some answers to this question before, but they seem to be obsolete for the current Python versions (or at least they don\'t work for me).
I want to chec
You could use next instead:
colors = ['yellow', 'orange', 'red']
search = "or"
result = next((True for color in colors if search in color), False)
print(result) # True
To show the string that contains the substring:
colors = ['yellow', 'orange', 'red']
search = "or"
result = [color for color in colors if search in color]
print(result) # Orange