Skip to main content
Loading page…
Python Mastery
Chapter 4
Lesson 4 of 5
Sets & Set Operations
Contents
Notes
Tutor
Concept
Sets: Unordered Collections of Unique Elements
Loading activity…
Previous
1 / 6
Continue
Contents
Notes
Discussion
Tutor
20 min
6 activities
0 of 6 done
In this lesson
1
Sets: Unordered Collections of Unique Elements
2
Set Operations: Union, Intersection, Difference
3
frozenset — The Immutable, Hashable Set
4
Creating an Empty Set
5
Shared and Exclusive Interests
6
Sets Beat Lists for Membership Tests
Objectives
Create sets and add or discard elements
Remove duplicates from a list using a set
Apply union, intersection, difference, and subset checks
Decide when a set is more appropriate than a list
Chapter 4 · Lists, Tuples, Sets & Dictionaries
Lists: The Workhorse
Tuples & Immutability
Dictionaries: Key–Value Power
Sets & Set Operations
Choosing the Right Container
Previous: Dictionaries: Key–Value Power
Next: Choosing the Right Container