Function Details: all

Description


Returns True if all elements of the iterable are true (or if the iterable is empty).


Extended Description


The all() function returns True if all elements in the given iterable are true. If the iterable is empty, it returns True. It's equivalent to using the and operator between all elements in the iterable. The function short-circuits; it stops iterating as soon as it finds a false value.


Exceptions


  • TypeError: If the argument is not iterable

Read More about all from Python Documentation

Function Signature


all(iterable: Iterable) -> bool

Module: builtins

Parameters


This function takes one parameter: iterable (an Iterable object). This can be any iterable such as a list, tuple, set, or generator.


Parameter List


  • iterable: Iterable

Return


Returns a boolean value. True if all elements are true (or if the iterable is empty), False otherwise.


Return Type


bool

Output

Explanation

This example shows how all() behaves with different types of iterables, including an empty iterable.