size of set python code example
Example 1: length of set python
setnum = {1,2,3,4,5}
# Find the length use len()
print(len(setnum)) #5
Example 2: get length of set python
# Create a set
seta = {5,10,3,15,2,20}
# Or
setb = set([5, 10, 3, 15, 2, 20])
# Find the length use len()
print(len(setb))