Loading topic
for loops and the in operator work, and the difference between mutable and immutable objects.2 min readfor loops and the in operator. Here you will learn the three ways to build a set, and which one to use in each2 min readin operator, for loops, and the difference between mutable and immutable objects. It also assumes you have seen how to create a set. Here you will learn how in works on a set, what can go wrong with it, and what to expect when you loop over a set.2 min readset is mutable, so you can change it after you create it. A frozenset is not mutable, and it is covered in a later chapter.2 min readin, and add or remove elements. Here you will combine two sets into a new one using the four standard set algebra operations.2 min readin, and combine sets with |, &, - and ^. Here you will learn how to ask questions about the relationship between two sets: does one contain the other, are they identical, or do they share nothing?3 min read|, &, - and ^, and that you understand mutable and immutable objects. The earlier operators build a new set. The in-place forms change an existing set instead.3 min readin works on a set, and the union, intersection and difference operators. Here you apply them to two everyday jobs: removing duplicates and checking membership quickly.2 min readset works, including hashability and the set operators from earlier chapters. You should also know the difference between mutable and immutable objects.2 min readin operator. It also assumes you know why set elements must be hashable. Here you will see the mechanism that makes set lookups fast, and the cases where that speed disappears.3 min readadd, remove and discard, and apply the set operators. It covers the mistakes intermediate learners make most often with sets, what Python does in each case, and how to fix it.2 min read