Thursday, 25 November 2021

Python: len(): Get number of items in the 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_set.py

evenNumbers={2, 4, 6, 8, 8, 4, 10}

print('len(evenNumbers) : ', len(evenNumbers))

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment