Javatpoint Logo
Javatpoint Logo

Python all() Method

Python all() method is used to check whether all the elements in the iterable are True or not. It takes an iterable argument and returns True if all the elements are True. It returns False if any element is False or iterable is empty. The Signature of the method is given below.

Signature

Parameters

iterable: List of iterable elements.

Return

It returns boolean either True or False.

Let's see some examples of all() method to understand it's functionality.

Python all() Method Example 1

This simple example returns true because all the elements are non zero. See the example below.

Output:

True

Python all() Method Example 2

This example returns False because the list contains an element 0.

Output:

False

Python all() Method Example 3

Output:

False
False
True
True

Next TopicPython Functions




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA