1 00:00:00,760 --> 00:00:02,370 - [Narrator] In this self check exercise, 2 00:00:02,370 --> 00:00:05,878 we want you to use the mathematical set operators 3 00:00:05,878 --> 00:00:08,710 to combine the two sets that we're showing you 4 00:00:08,710 --> 00:00:10,560 as part of the problem statement here, 5 00:00:10,560 --> 00:00:12,390 and produce the results shown 6 00:00:12,390 --> 00:00:15,260 in parts A through D down below. 7 00:00:15,260 --> 00:00:18,440 So using the operators that you just learned about, 8 00:00:18,440 --> 00:00:20,720 why don't you pause the video and give that a shot, 9 00:00:20,720 --> 00:00:22,713 then come back here for the answers? 10 00:00:27,840 --> 00:00:30,580 Okay, let's talk about the possibilities here. 11 00:00:30,580 --> 00:00:32,500 So, for part A here, 12 00:00:32,500 --> 00:00:35,730 the resulting set should contain only 30. 13 00:00:35,730 --> 00:00:37,110 And if you take a look here, 14 00:00:37,110 --> 00:00:39,538 you'll see that 10 and 20 are common 15 00:00:39,538 --> 00:00:42,070 between these two sets. 16 00:00:42,070 --> 00:00:43,360 Five is not in common, 17 00:00:43,360 --> 00:00:45,850 but since the result only has 30 in it, 18 00:00:45,850 --> 00:00:47,950 it appears what we're trying to do here 19 00:00:47,950 --> 00:00:51,300 is calculate the difference between the sets. 20 00:00:51,300 --> 00:00:54,010 So when I subtract the right hand set 21 00:00:54,010 --> 00:00:55,550 from the left hand set, 22 00:00:55,550 --> 00:00:58,130 the set difference is going to consist of 23 00:00:58,130 --> 00:01:01,480 the elements in the left that are not in the right, 24 00:01:01,480 --> 00:01:04,270 and the only such element in this case is 30. 25 00:01:04,270 --> 00:01:06,210 So let me reveal my answer. 26 00:01:06,210 --> 00:01:09,620 Here is the minus operation for set difference, 27 00:01:09,620 --> 00:01:11,110 and if I execute that, 28 00:01:11,110 --> 00:01:12,910 indeed I get 30. 29 00:01:12,910 --> 00:01:14,310 Now in this next one, 30 00:01:14,310 --> 00:01:16,060 we get five, 15, and 30, 31 00:01:16,060 --> 00:01:19,160 and if you look carefully at all the values here, 32 00:01:19,160 --> 00:01:23,260 10 and 20 are common between these two sets, 33 00:01:23,260 --> 00:01:26,230 but five and 15 on the right side 34 00:01:26,230 --> 00:01:27,620 and 30 on the left side 35 00:01:27,620 --> 00:01:30,210 are differences between the two sets. 36 00:01:30,210 --> 00:01:33,191 So this appears to be a symmetric difference. 37 00:01:33,191 --> 00:01:35,430 And if we go ahead and take a look 38 00:01:35,430 --> 00:01:37,280 at this next solution here, 39 00:01:37,280 --> 00:01:39,740 we're using the symmetric difference operator, 40 00:01:39,740 --> 00:01:44,710 and indeed we do get the result specified in part B. 41 00:01:44,710 --> 00:01:46,870 Now if you look at part C here, 42 00:01:46,870 --> 00:01:49,129 the resulting set has everything 43 00:01:49,129 --> 00:01:52,630 that's unique to both of these sets, 44 00:01:52,630 --> 00:01:55,700 so this appears to be a union operation. 45 00:01:55,700 --> 00:01:57,010 So I'll go ahead and reveal 46 00:01:57,010 --> 00:01:59,710 the use of the union operator here, 47 00:01:59,710 --> 00:02:03,350 and indeed we get the values shown in part C. 48 00:02:03,350 --> 00:02:07,300 And finally, we want to do an intersection as well, 49 00:02:07,300 --> 00:02:09,440 and if you look at part D's answer, 50 00:02:09,440 --> 00:02:11,570 the intersection of these two sets 51 00:02:11,570 --> 00:02:13,470 are the values 10 and 20, 52 00:02:13,470 --> 00:02:16,240 which are in both the left and the right operand. 53 00:02:16,240 --> 00:02:18,490 So just to demonstrate the intersection 54 00:02:18,490 --> 00:02:20,460 with the ampersand operator there, 55 00:02:20,460 --> 00:02:23,913 you can see that indeed we get 10 and 20 as our result.