I'm having the following codes to test whether string 'h' is in any of the string in list aa. But it's giving me the TypeError: 'bool' object is not iterable. Why is that?
aa = ['hh', 'ii']
any('h' in aa)
Traceback (most recent call last):
File "<string>", line 2, in <module>
TypeError: 'bool' object is not iterable
any('h' in aa)is giving you error exactly as showed in the error message because the conditional returns a boolean which is not an iterable needed for theanyfunction input.