Membership testing of sets

Membership is a fundamental operation for sets, and as with the other collection types is performed using the in and not in operators:

>>> q = { 2, 9, 6, 4 }
>>> 3 in q
False
>>> 3 not in q
True
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset