Friday 26 November 2021

Python: len(): get number of items in the frozen set

‘len(s)’ function is used to get the length of the object. Here the argument ‘s’ can be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

 

len_frozenset.py

vowels = ('a', 'e', 'i', 'o', 'u')

fSet = frozenset(vowels)

print('len(fSet) : ', len(fSet))

 

Output

len(fSet) :  5

 

 

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment