I faced with a usage of any() like this:
return any(node.state == state for node in self.frontier)
When I checked, any() returns True if any element of an iterable is True.So i think that if any() checks any element of an iterable, why do we use for loop? it already checks every element in it..
Another thing I didn't understand with this syntax is that what does it do in for loop? it is at the end of the line, and there is nothing after it..