Any and All are two built ins provided in python used for successive And/Or.
Returns true if any of the items is True. It returns False if empty or all are false. Any can be thought of as a sequence of OR operations on the provided iterables.
It short circuit the execution i.e. stop the execution as soon as the result is known.
Syntax : any(list of iterables)
False True True
Returns true if all of the items are True (or if the iterable is empty). All can be thought of as a sequence of AND operations on the provided iterables. It also short circuit the execution i.e. stop the execution as soon as the result is known.
Syntax : all(list of iterables)
True False False
This article is contributed by Mayank Rawat .If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Chaining comparison operators in Python
- Inplace vs Standard Operators in Python
- Operator Functions in Python | Set 2
- Operator Functions in Python | Set 1
- Packing and Unpacking Arguments in Python
- Counters in Python | Set 1 (Initialization and Updation)
- Global and Local Variables in Python
- Ternary Operator in Python
- Loops and Control Statements (continue, break and pass) in Python
- Using Iterations in Python Effectively
- Iterators in Python
- Python | end parameter in print()
- Division Operators in Python
- Increment and Decrement Operators in Python
- G-Fact 19 (Logical and Bitwise Not Operators on Boolean)