Python all()

The all() function returns Ture if all elements are itterable and False if elements are not.

Parameters

all(iterable)

iterable – is an object that can be looped over such as list , string , tuple etc.

Ex.

list = [Joe, Moe,Roy ]
print(all(list))

Str = "www.codeit.blog"
print(all(Str))

dict = {0: 'True', 1: 'False'}
print(all(dict))

Output :

True
True
False

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s