- Welcome to lesson five,
sequences, lists, and tuples.
Back in part one in lessons three and four,
we began to introduce these two key data structures
that you will use extensively
in your Python application development.
Here we're going to talk about
all of the additional details
of these two key data structures.
We'll start out by creating a variety of objects
of these types, initializing those objects,
and showing you how to access their individual elements,
and also ranges of elements as well.
We'll also talk, for lists,
about both sorting and searching the lists,
and for tuples, about searching tuples as well.
We'll show you how to pass objects of these types
to functions and methods,
and we'll begin talking about various methods
built into the list type itself.
We'll continue lesson five with our discussion
of functional-style programming
in the context of Python.
Python itself is not a functional programming language,
or a pure functional programming language.
It is a multi-paradigm language
that has some capabilities
of functional-style programming,
and that's what we're going to be presenting to you
in this part of the lesson.
We'll introduce the concept
of lambda expressions in Python,
which are basically anonymous function definitions.
We'll take a look at various filter,
mapping, and reduction capabilities.
Initially, we'll do that in the context
of what's known as a list comprehension,
which is a syntax element built into the language
for conveniently creating new lists
from other sequences of values.
Then we'll also take a look at filter, map, reduce
in the context of functions
that are built into the Python standard library.
We'll also introduce as part of this lesson
two-dimensional lists very briefly.
The only reason we're going to do that
is to show you the syntax,
because once we move over to lesson seven,
we're going to introduce
array-oriented programming with NumPy.
That's the way that you're normally going to build
a multi-dimensional data structure in Python.
We'll finish up this particular lesson
with a visualization introduction
in the context of our intro to data science section.
In this particular section,
we're going to create a die-rolling simulation
that produces a static visualization.
Basically we're going to roll a six-sided die
some number of times
and then produce a static bar plot at the end
that shows how many ones we got,
how many twos we got, all the way up through sixes.
If we have a good random number generator,
we should get approximately 1/6
of whatever total number of rolls should be ones,
twos, threes, fours, fives, and sixes respectively.
In the next lesson,
we'll do that same visualization again,
but using dynamic visualization
in the context of animation techniques
provided by the Matplotlib library.