How does all() in python work on empty lists
It’s true because for every element in the list, all 0 of them, they all are equal to 2. You can think of all being implemented as: def all(my_list, condition): for a in my_list: if not condition(a): return False return True Whereas any is: def any(my_list, condition): for a in my_list: if condition(a): return True … Read more