Python – Length of Frozen Set

To find the length of a frozen set in Python, call len() builtin function and pass the frozen set object as argument. len() function returns the number of items in the frozen set.

Reference – Python len() builtin function

In the following example, we will take a frozen set, and find its length using len() function.

Python Program

ADVERTISEMENT
frozensetObject = frozenset({'a', 'b', 'c', 'd'})
length = len(frozensetObject)
print(f'Length of this frozen set is {length}.')
Try Online

Output

Length of this frozen set is 4.

Conclusion

In this Python Tutorial, we learned how to find the length of Python Frozen Set object using len() function, with example program.