Created
September 6, 2013 07:16
-
-
Save gideondsouza/6460529 to your computer and use it in GitHub Desktop.
Introducing a set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> | |
>>> S = {1,3} #a new set with two elements | |
>>> type(S) #what is the type of S? | |
<class 'set'> | |
>>> S1 = {3,4,5} #initialize two sets S1 and S2 | |
>>> S2 = {3,6,7} | |
>>> S1 | S2 #this will give you a union of the two. | |
{3, 4, 5, 6, 7} | |
>>> #you can also use & for intersection, and ^ for xor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment