Using Python's any() & Working With Multiple Booleans

preview_player
Показать описание
As a Python programmer, you’ll frequently deal with Booleans and conditional statements—sometimes very complex ones. In those situations, you may need to rely on tools that can simplify logic and consolidate information. Fortunately, any() in Python is such a tool. It looks through the elements in an iterable and returns a single value indicating whether any element is true in a Boolean context, or truthy.

This lesson is part of a larger course about the any() function and booleans.

Рекомендации по теме
Комментарии
Автор

Okay... it is time to go back and find other keywords I have missed. Thank you :)

Does "Any()" exit on the first instance of True encountered, or does it complete the iterator?

Thinking of conditions like... with nested loops inside of a list comprehension. So order things appropriately if you can...

JohnBoen
Автор

Why I didn't knew this function before?

RicardoLuna
Автор

This works simular to the IN operator of SQL, and even Python's own IN-operator.

moneymo