How can you get the size of a set? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can you get the size of a set?

14th Jun 2018, 3:07 PM
Israel Emmanuel
Israel Emmanuel - avatar
4 Answers
+ 2
Please mentions the language. In case you're talking about Python, >>> my_set = {1, 1, 2, 3, 5} >>> len(my_set) 4
14th Jun 2018, 3:25 PM
Just A Rather Ridiculously Long Username
+ 1
>>> a={1,2,3,4,5,6,7} >>> len(a) 7
14th Jun 2018, 3:23 PM
Gopal Gautam
Gopal Gautam - avatar
+ 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).
14th Jun 2018, 5:12 PM
$ยข๐Žโ‚น๐”ญ!๐จ๐“
$ยข๐Žโ‚น๐”ญ!๐จ๐“ - avatar
0
Thank you for your help... I finally figured it out. ๐Ÿ˜€
14th Jun 2018, 3:26 PM
Israel Emmanuel
Israel Emmanuel - avatar