Python Get the Length of a Set


Get the Length of a Set

To determine how many items a set has, use the len() method.

Example

Get the number of items in a set:

thisset = {"apple", "banana", "cherry"}

print(len(thisset))
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.