How can i reduce this condition ?
item is always a string
for item in list_of_items:
if ('beans' in item or 'apple' in item or 'eggs' in item or 'banana' in item) and ('elephant' not in item) or 'chicken' not in item:
print(item)
I mean can I somehow give list of words to check every possibility?
set(list_of_items).intersection({'beans', 'apple', 'eggs', 'banana'})