4 ms·
I remember explaining this rather simply, the same question actually. Look at the implementation. def all(it): for v in it: if not v:
by junon 3y ago
I remember explaining this rather simply, the same question actually. Look at the implementation.
def all(it):
for v in it:
if not v:
return False
return True
If there are no items, it returns True.
def any(it):
for v in it:
if v:
return True
return False
If there are no items, it returns False.
There's no need for fancy mathematical or "marbles in a bag" explanations here. Just look at the code.