1 00:00:00,290 --> 00:00:01,940 - [Instructor] In this Self Check exercise, 2 00:00:01,940 --> 00:00:04,490 I'd like you to go ahead and create a list of integers 3 00:00:04,490 --> 00:00:06,480 containing these five values, 4 00:00:06,480 --> 00:00:09,710 then use the list method index that we just demonstrated 5 00:00:09,710 --> 00:00:13,810 to you to search for both the values 43 and 44. 6 00:00:13,810 --> 00:00:18,040 And of course, 43 will be in the list, and 44 will not. 7 00:00:18,040 --> 00:00:19,940 Now when you do search for 44, 8 00:00:19,940 --> 00:00:23,180 make sure that no value error occurs. 9 00:00:23,180 --> 00:00:24,940 So go ahead and pause the video 10 00:00:24,940 --> 00:00:27,150 and give that a shot and then come back here 11 00:00:27,150 --> 00:00:28,453 to see the results. 12 00:00:32,190 --> 00:00:34,250 Okay, let's check out the results. 13 00:00:34,250 --> 00:00:37,070 So first, we need to create that list. 14 00:00:37,070 --> 00:00:41,360 Now, we happen to know in this case that 43 is in the list. 15 00:00:41,360 --> 00:00:44,230 So for this one, we simply are going to evaluate 16 00:00:44,230 --> 00:00:47,890 the expression numbers.index with 43 as an argument, 17 00:00:47,890 --> 00:00:50,300 and we know we don't need to worry about an exception 18 00:00:50,300 --> 00:00:54,050 occurring just because we can see what we put into the list. 19 00:00:54,050 --> 00:00:56,010 Of course, you may want to program 20 00:00:56,010 --> 00:00:59,520 that differently in a more robust application. 21 00:00:59,520 --> 00:01:01,310 But for the second piece here, 22 00:01:01,310 --> 00:01:03,570 where we wanna search for the value 44. 23 00:01:03,570 --> 00:01:06,540 Again, we can validate that the value 24 00:01:06,540 --> 00:01:11,540 is in the list before we perform the indexing operation. 25 00:01:11,940 --> 00:01:15,950 So if 44 is found in the list called numbers, 26 00:01:15,950 --> 00:01:18,440 then and only then will we go ahead 27 00:01:18,440 --> 00:01:21,380 and actually search for the value 28 00:01:21,380 --> 00:01:23,020 and find out its index, 29 00:01:23,020 --> 00:01:26,210 otherwise, we're going to print that 44 is not found. 30 00:01:26,210 --> 00:01:29,983 So let's execute that and indeed 44 is not found.