1
00:00:05,280 --> 00:00:09,200
In the Introduction to sets video, we 
looked at what sets are, and discussed 

2
00:00:09,200 --> 00:00:13,760
things like set membership, and the various 
operations that we can perform on sets. 

3
00:00:13,760 --> 00:00:19,360
I finished that video by mentioning subsets and 
supersets. I didn't go into detail at the time, 

4
00:00:19,360 --> 00:00:24,320
because we'd had enough theory at that point.
In the next few videos, we'll see what subsets 

5
00:00:24,320 --> 00:00:28,599
and supersets are, and how we 
can test for them in Python. 

6
00:00:30,720 --> 00:00:35,680
This diagram represents two sets: a 
set of animals, and a set of birds. 

7
00:00:35,680 --> 00:00:40,253
Birds are also animals, and all of our 
birds are also members of the Animals set. 

8
00:00:41,760 --> 00:00:44,494
When all the items of one 
set are also in another set, 

9
00:00:44,494 --> 00:00:47,840
the contained set is called a 
subset of the containing set. 

10
00:00:47,840 --> 00:00:51,933
Here, Birds is a subset of Animals 
– as we can see on the next slide. 

11
00:00:54,720 --> 00:00:57,387
In set theory, that would be written as: 

12
00:00:59,920 --> 00:01:02,936
In Python, we use the less 
than or equal to symbol: 

13
00:01:08,320 --> 00:01:13,120
Birds is also a proper subset of Animals.
A proper subset is a subset that also isn't 

14
00:01:13,120 --> 00:01:18,352
equal to the set that contains it. The 
distinction is important, in set theory. 

15
00:01:20,080 --> 00:01:23,261
In set theory, a proper 
subset would be written as: 

16
00:01:26,320 --> 00:01:28,889
In Python, we use the less than symbol: 

17
00:01:33,760 --> 00:01:38,780
Birds is a subset of Animals, and we also 
say that Animals is a superset of Birds. 

18
00:01:38,960 --> 00:01:42,192
That means all the items of 
Birds are contained in Animals. 

19
00:01:42,240 --> 00:01:48,418
The two terms are complementary. If set A is 
a subset of B, then set B is a superset of A. 

20
00:01:50,245 --> 00:01:52,336
In set theory, that's written:

21
00:01:55,297 --> 00:01:58,793
In Python, we use the greater than or equal to symbol:

22
00:02:03,737 --> 00:02:06,569
Animals is also a proper superset of Birds.

23
00:02:06,720 --> 00:02:11,082
A proper superset is a set that contains 
another set, but isn't equal to it. 

24
00:02:12,960 --> 00:02:15,345
In set theory, that's written:

25
00:02:18,221 --> 00:02:20,936
In Python, we use the greater than symbol:

26
00:02:25,760 --> 00:02:29,600
With small sets, when we can draw 
diagrams, it's fairly easy to work 

27
00:02:29,600 --> 00:02:34,960
out if one set is a superset or subset of another.
When we're working with large sets, or have many 

28
00:02:34,960 --> 00:02:39,920
sets to check, Python can make this much easier.
Make sure you understand what a subset and 

29
00:02:39,920 --> 00:02:44,319
a superset is, and that you understand 
what proper subsets and supersets are. 

30
00:02:44,400 --> 00:02:48,800
A proper subset must contain fewer elements 
than its superset, and a proper superset 

31
00:02:48,800 --> 00:02:53,440
must contain more elements than the subset.
In the next video, we'll write some Python 

32
00:02:53,440 --> 00:02:58,550
code to check if one set is a subset of another 
set, then we'll look at a practical application. 

33
00:03:00,080 --> 00:03:03,840
See you in the next video.

