Python all() method is a built-in method. It is used to check that all the elements in iterable (list, tuple, set) are True. It returns True, if all the elements are True or the iterable is empty. It returns false when any single element or all the elements are false.
True means: any iterable that does not contain any element like: 0(zero), 0.0, false, None, will be treated as True.
Parameter | Description |
---|---|
iterable | (Required) This argument can be a list, tuple, dictionary, string etc. |
It returns either True or False based on the elements present in the iterable.
Let’s first understand, how this method works and what does it return?
This method returns false in the following scenarios.