+ 2
How can you get the size of a set?
4 Antworten
+ 2
Please mentions the language. In case you're talking about Python,
>>> my_set = {1, 1, 2, 3, 5}
>>> len(my_set)
4
+ 1
>>> a={1,2,3,4,5,6,7}
>>> len(a)
7
+ 1
len(s)
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
0
Thank you for your help... I finally figured it out. 😀