# all()

``all(my_iterable)``
my_iterable : iterable input
Return Boolean value True or False based on this table.

## Difference between any() and all()

Elements of the iterable any()
Output
all()
Output
All are TrueTrueTrue
All are FalseFalseFalse
One value is True ( Others False)TrueFalse
One value is False ( Others True)TrueFalse
Empty FalseTrue

## Empty List

``````list=[]
print(all(list)) # True``````
List
``````list = [1, 2, 3, 4, 55]
print(all(list)) # True``````

## All elements are False

``````list=[0,False]
print(all(list)) # False``````

## One element is True

``````list=[False,True]
print(all(list))  # False``````

## Using string

``````url='plus2net.com'
print(all(url))    # True
url='False'
print(all(url))    # True``````
We will use Dictionary

Output depends on Keys of the Dictionary ( Not Values ). If all one of the key is True then output is True. If all keys are False then output is False.
``````my_dict={0:'A',1:'B'}
print(all(my_dict)) # False  ``````
``````my_dict={0:'A',0:'B'}
print(all(my_dict)) # False``````
``````my_dict={0:True,0:False}
print(all(my_dict)) # False``````
``````my_dict={1:True,2:False}
print(all(my_dict)) # True``````
We will use tuple
``````my_tuple=(True,1,12)
print(all(my_tuple)) # True``````
``````my_tuple=(True,0)
print(all(my_tuple)) # False``````
``````my_tuple=(0,0)
print(all(my_tuple)) # False``````
``````my_tuple=(0,1)
print(all(my_tuple)) # False``````

Subscribe to our YouTube Channel here

## Subscribe

* indicates required
Subscribe to plus2net

plus2net.com