list = ['hi', 'hello', 'pee', ('poo' , 'pap') , 'noog']
post_lower = ' i am a big idiot'
if any(word in post_lower for word in list):
print('true')
else:
print('false')
what im trying to do is if there is hi or hello it will return true, however i want it to only return true if BOTH poo and pap is in the string. I am getting TypeError: 'in ' requires string as left operand, not tuple
the reason im making this because im making a bot that recognizes certain keywords in posts, like for example python course and beginner. Now python on it self does not mean anything however if both python course and beginner is in a string it means that the post is asking for best courses for beginners. However it can be worded differently and have different grammar
thanks for your help
word in post_loweris actuallyeach_character in post_lowerbecause iterating over a string means iterating over individual characters.