1 00:00:06,630 --> 00:00:08,020 - Welcome to lesson five, 2 00:00:08,020 --> 00:00:11,000 sequences, lists, and tuples. 3 00:00:11,000 --> 00:00:14,170 Back in part one in lessons three and four, 4 00:00:14,170 --> 00:00:17,080 we began to introduce these two key data structures 5 00:00:17,080 --> 00:00:19,100 that you will use extensively 6 00:00:19,100 --> 00:00:21,590 in your Python application development. 7 00:00:21,590 --> 00:00:23,080 Here we're going to talk about 8 00:00:23,080 --> 00:00:24,880 all of the additional details 9 00:00:24,880 --> 00:00:27,200 of these two key data structures. 10 00:00:27,200 --> 00:00:30,180 We'll start out by creating a variety of objects 11 00:00:30,180 --> 00:00:32,830 of these types, initializing those objects, 12 00:00:32,830 --> 00:00:36,260 and showing you how to access their individual elements, 13 00:00:36,260 --> 00:00:38,820 and also ranges of elements as well. 14 00:00:38,820 --> 00:00:40,560 We'll also talk, for lists, 15 00:00:40,560 --> 00:00:44,190 about both sorting and searching the lists, 16 00:00:44,190 --> 00:00:47,650 and for tuples, about searching tuples as well. 17 00:00:47,650 --> 00:00:50,140 We'll show you how to pass objects of these types 18 00:00:50,140 --> 00:00:52,040 to functions and methods, 19 00:00:52,040 --> 00:00:54,650 and we'll begin talking about various methods 20 00:00:54,650 --> 00:00:57,523 built into the list type itself. 21 00:00:58,920 --> 00:01:01,670 We'll continue lesson five with our discussion 22 00:01:01,670 --> 00:01:03,780 of functional-style programming 23 00:01:03,780 --> 00:01:05,890 in the context of Python. 24 00:01:05,890 --> 00:01:09,340 Python itself is not a functional programming language, 25 00:01:09,340 --> 00:01:12,130 or a pure functional programming language. 26 00:01:12,130 --> 00:01:14,740 It is a multi-paradigm language 27 00:01:14,740 --> 00:01:16,730 that has some capabilities 28 00:01:16,730 --> 00:01:18,400 of functional-style programming, 29 00:01:18,400 --> 00:01:20,690 and that's what we're going to be presenting to you 30 00:01:20,690 --> 00:01:22,750 in this part of the lesson. 31 00:01:22,750 --> 00:01:24,230 We'll introduce the concept 32 00:01:24,230 --> 00:01:26,570 of lambda expressions in Python, 33 00:01:26,570 --> 00:01:29,380 which are basically anonymous function definitions. 34 00:01:29,380 --> 00:01:31,460 We'll take a look at various filter, 35 00:01:31,460 --> 00:01:34,200 mapping, and reduction capabilities. 36 00:01:34,200 --> 00:01:36,390 Initially, we'll do that in the context 37 00:01:36,390 --> 00:01:38,780 of what's known as a list comprehension, 38 00:01:38,780 --> 00:01:41,680 which is a syntax element built into the language 39 00:01:41,680 --> 00:01:44,820 for conveniently creating new lists 40 00:01:44,820 --> 00:01:47,040 from other sequences of values. 41 00:01:47,040 --> 00:01:49,760 Then we'll also take a look at filter, map, reduce 42 00:01:49,760 --> 00:01:51,360 in the context of functions 43 00:01:51,360 --> 00:01:55,210 that are built into the Python standard library. 44 00:01:55,210 --> 00:01:57,310 We'll also introduce as part of this lesson 45 00:01:57,310 --> 00:01:59,890 two-dimensional lists very briefly. 46 00:01:59,890 --> 00:02:01,480 The only reason we're going to do that 47 00:02:01,480 --> 00:02:03,090 is to show you the syntax, 48 00:02:03,090 --> 00:02:06,380 because once we move over to lesson seven, 49 00:02:06,380 --> 00:02:07,490 we're going to introduce 50 00:02:07,490 --> 00:02:10,060 array-oriented programming with NumPy. 51 00:02:10,060 --> 00:02:12,590 That's the way that you're normally going to build 52 00:02:12,590 --> 00:02:16,300 a multi-dimensional data structure in Python. 53 00:02:16,300 --> 00:02:18,350 We'll finish up this particular lesson 54 00:02:18,350 --> 00:02:21,780 with a visualization introduction 55 00:02:21,780 --> 00:02:26,060 in the context of our intro to data science section. 56 00:02:26,060 --> 00:02:28,320 In this particular section, 57 00:02:28,320 --> 00:02:31,400 we're going to create a die-rolling simulation 58 00:02:31,400 --> 00:02:34,400 that produces a static visualization. 59 00:02:34,400 --> 00:02:36,720 Basically we're going to roll a six-sided die 60 00:02:36,720 --> 00:02:37,980 some number of times 61 00:02:37,980 --> 00:02:40,970 and then produce a static bar plot at the end 62 00:02:40,970 --> 00:02:42,580 that shows how many ones we got, 63 00:02:42,580 --> 00:02:45,560 how many twos we got, all the way up through sixes. 64 00:02:45,560 --> 00:02:47,690 If we have a good random number generator, 65 00:02:47,690 --> 00:02:50,260 we should get approximately 1/6 66 00:02:50,260 --> 00:02:53,230 of whatever total number of rolls should be ones, 67 00:02:53,230 --> 00:02:56,870 twos, threes, fours, fives, and sixes respectively. 68 00:02:56,870 --> 00:02:57,770 In the next lesson, 69 00:02:57,770 --> 00:03:00,130 we'll do that same visualization again, 70 00:03:00,130 --> 00:03:02,490 but using dynamic visualization 71 00:03:02,490 --> 00:03:05,140 in the context of animation techniques 72 00:03:05,140 --> 00:03:07,883 provided by the Matplotlib library.