if you're paying attention to the outputyou'll notice that the items are not printed in the order they were added to the sets setslike dictionariesare unordered they both use an underlying hash-based data structure for efficiency because they are unorderedsets cannot have items looked up by index the primary purpose of set is to divide the world into two groups"things that are in the set"and"things that are not in the setit is easy to check whether an item is in the set or to loop over the items in setbut if we want to sort or order themwe'll have to convert the set to list this output shows all three of these activities"opethin artists true for artist in artistsprint("{plays good musicformat(artist)sarah brightman plays good music guns nroses plays good music vixy and tony play good music opeth plays good music alphabetical list(artistsalphabetical sort(alphabetical ["guns nroses"'opeth''sarah brightman''vixy and tony'while the primary feature of set is uniquenessthat is not its primary purpose sets are most useful when two or more of them are used in combination most of the methods on the set type operate on other setsallowing us to efficiently combine or compare the items in two or more sets these methods have strange namessince they use the same terminology used in mathematics we'll start with three methods that return the same resultregardless of which is the calling set and which is the called set the union method is the most common and easiest to understand it takes second set as parameter and returns new set that contains all elements that are in either of the two setsif an element is in both original setsit willof courseonly show up once in the new set union is like logical or operationindeedthe operator can be used on two sets to perform the union operationif you don' like calling methods