- Welcome to Python Fundamentals Part 1 of 5.
My name is Paul Deitel and I'll be your instructor
for these LiveLessons videos.
I'm the CEO of Deitel & Associates, Inc.,
an MIT grad with 38 years of experience in computing,
and also one of the world's most experienced
programming languages trainers,
having been teaching programming training since 1992.
Throughout these LiveLessons videos,
you're going to be working hands-on
with the Python programming language.
This is now one of world's
most popular programming languages
and it's also the fastest growing among them.
Professionals often discover quickly
that they really like Python for a number of reasons.
It's a general purpose programming language
so you can use it for lots of different tasks.
It's concise and extremely expressive
so you can really write a lot of complex applications
with relatively minimal amounts of code.
It's very readable so it's easy to learn.
It's interactive because there's an interactive mode
in the IPython interpreter that we'll be using
so you can go right down
to the individual programming snippet level
and see exactly what that statement
or snippet is going to do immediately.
There's a massive open source community
surrounding Python as well,
developing incredibly powerful libraries
that you're going to take advantage of
over the five parts of these LiveLessons.
And the job market, in particular for Python,
is extremely strong right now,
especially for anybody
who has any kind of data science skills
and artificial intelligence skills as well.
Part one of these Python Fundamentals LiveLessons videos
is based on the Before You Begin section
and chapters one through four
of our recently published Python books,
"Intro to Python for Computer Science and Data Science:
"Learning to Program with AI, Big Data and the Cloud,"
that's our textbook, and also our professional book,
"Python for Programmers."
Many people find that,
as they work their way through the videos,
it's helpful to have a copy of the book at hand.
However, this is not required.
There is additional information in the books
that I don't cover as part of these videos.
If you're interested in getting a copy of one of the books,
you can find them in various print and electronic formats
at the sites that are listed for you.
If you're a college instructor,
you'll probably want to take a look
at "Intro to Python for Computer Science and Data Science,"
which is our college textbook version of the book.
This one is in full color, it's 880 pages,
240 pages more than "Python for Programmers,"
and in particular, it contains a ton of exercises,
557 self-check exercises as well as 471 additional
end of chapter exercises and projects.
Now many professionals find
that they like to work with the textbook version
specifically because of the exercises.
If you're interested in learning more about
"Intro to Python for Computer Science and Data Science,"
please take a look at the links that I have provided below.
The first one is for an architectural diagram
in which we show you the four-part modular structure
of this book and that really applies
both to the college textbook and our professional book,
"Python for Programmers," as well.
The for programmers book has one fewer chapter,
but the overall architecture of the two books is the same.
And also, in the for programmers book,
we have less of the lower end pedagogical material
that's really geared to people
who are novices in programming.
The second link is for the full table of contents
where you can see everything that we're going to cover
throughout the book.
And the third one is the book's preface
where you can learn more about our approach
to teaching Python, data science, artificial intelligence,
and various big data topics.
I'd also like to recommend that you take a look
at these two additional links.
The first one is for the full book cover, and in particular,
if you look at the back cover copy,
you'll see a nice summary of everything
that we're going to do throughout these LiveLessons videos.
And I'd also recommend that you take a moment
to read through the technical
and academic reviewer testimonials
to really get a sense of all the things that they liked
about how we presented Python and the various data science,
AI, and big data topics.
Next, let's talk about the modular architecture
of these videos, which also applies to the books as well.
In lessons one through 10 of these videos,
we'll be focused on Python programming fundamentals,
and throughout those lessons we have,
at the end of each one,
an introduction to data science
in which we're going to introduce things
like artificial intelligence, basic descriptive statistics,
measures of central tendency and dispersion,
simulation techniques, working with CSV files.
We're going to introduce a really powerful library
called pandas which you'll use extensively
throughout the rest of the lessons once we introduce it.
And we're also going to start to take a look at the concepts
of time series and simple linear regression.
All of these topics are meant
to help support the case study lessons
that we'll be looking at in lessons 11 through 16.
As you work through the high-end case study lessons
in parts four and five
of these Python Fundamentals LiveLessons videos,
one of the things I'll be doing with you
is introducing a lot of real-world data sets.
Many of the libraries I'll present to you come bundled
with data sets that you can use to learn
about working with those libraries
and learn various AI, data science,
and big data topics as well.
And in addition you're going to find
that you can acquire data sets from a wide range of sources.
There are all sorts of data set repositories out there,
various governments provide big data data sets
that you can take advantage of including the US government,
and you'll also find that there's many additional data sets
bundled with these libraries.
And some of the libraries also give you convenient ways
to load data sets from those massive data set repositories
that are available to you.
Now, after you've worked your way
through lessons one through five
and some parts of lessons six and seven,
you'll actually be able to go ahead
and attack the really cool concepts
that we're going to be presenting to you
in lessons 11 through 16.
But I do encourage you not to skip
any of the lessons along the way.
There are lots of interesting topics
in lessons eight, nine, and 10,
including all of Python's object-oriented
programming concepts as well.
As we developed the content
on which these LiveLessons videos are based,
we kept three principles in mind.
Keep it simple, keep it small, and keep it topical.
With respect to keep it simple,
one of the things we really wanted to do
was make it super easy for people
to get into the Python programming language.
So we really strived for simplicity
and clarity in our writing
and in the way that we presented the material.
We also preferred the simpler libraries
that are available to us.
So one of the things that you're going to get
out of the five parts of these LiveLessons videos
is an introduction to many different open source libraries,
some of which are bundled with Python,
some of which are simply available
via the open source community.
And, whenever we had a choice
between a couple of different libraries
that could do the same thing,
we always went with the one that was simpler to use.
With respect to keep it small,
you're going to find that the vast majority
of the book's 538 code examples are extremely small.
Sometimes just one line of code or a few lines of code.
However, when you're programming,
you often are going to be building larger applications,
so we also include 40 larger scripts
and in-depth case studies as well.
With respect to keep it topical,
we did one and a half years of research
in preparation for writing our Python books
and recording these Python videos as well.
And normally, when we get ready to write any book,
we'll create what we call a resource center,
and we'll have anywhere
from 25 to 50 different key research pieces
on which we will base our writings and the examples
that we eventually use in these video recordings as well.
Now, for the Python content,
we actually had 1500 different resource centers,
each of which averaged around 10 different research pieces.
So about 15,000 different pieces,
whether they were books, or articles, or videos,
or blog posts went into our research for this material.
And what that enabled us to do was really take the pulse
of all the different communities
that we were trying to target with the content in this book,
whether it be the computer science community,
the data science community, the Python community in general,
or the AI big data and cloud communities as well.
And that also enabled us to create some really cool
and interesting examples that I'll be presenting to you
in these videos.
The best way to use these videos is to watch a little
and then do a little and one of the reasons
that it works so well to take that approach
is the IPython interpreter that you'll see me using
throughout my presentation.
The IPython interpreter gives you immediate feedback,
enabling you to write anything from a simple expression
like seven plus three and see the result
up through large chunks of code as well,
and you can immediately execute those expressions,
statements, and chunks of code and see the results.
If you get an error,
you can see the code and the error right next to each other
so you can go back and fix that problem
and try again instantaneously.
And, if it's a correct piece of code,
you can see the results immediately,
which makes it a really great way
to learn the language, explore the language,
and also to explore the many different libraries
that you have access to via the open source community.
Throughout lessons one through 10,
my key focus will be on presenting rich coverage
of Python programming fundamentals.
Now, not only will I be showing you the syntax
of the language but we'll also be looking
at three different programming idioms.
We'll look at procedural style programming in Python,
object-oriented programming,
and functional-style programming as well.
And, throughout all of the examples,
we'll be focusing on best practices
and current Python idiom.
During our one and a half years of research
leading into this project,
one of the things that we found is that the vast majority
of programming that people do in Python
is what we like to refer to as object-based programming.
You import a library,
create an object of one of the types in that library,
and then interact with that object.
And one of the reasons that you're able to do that
is the literally thousands of different Python libraries
that are available to you.
Now the Python standard library itself
has a tremendous number of what are called modules
that you can import into your applications and use.
And the table that you see on the screen
is just a small subset of those libraries.
And in particular ones that we'll be focusing on
throughout these LiveLessons videos.
In addition we'll be focusing
on lots of other open source libraries,
many of which are actually installed
with the Anaconda Python distribution
that I'll be using as I present Python to you.
On the screen now you see
some of the key artificial intelligence, data science,
and big data-related libraries
that we'll be presenting throughout these videos.
During the 1850s Gold Rush, there was a saying,
"There is gold in them thar hills."
Well in 2019 and '20 and beyond, we can say instead,
"There's gold in them thar data."
Almost all of the cutting edge applications
that are being developed nowadays
are data-driven applications
and specifically big data-driven applications.
So another saying that you may have heard previously
is that "A picture is worth a thousand words."
Well, when you're talking about big data,
a visualization, which is just a diagram,
is something that could be worth billions
or even trillions of data items in a big data source.
So, with that in mind, we're going to be presenting scores
of static, dynamic, and interactive visualizations
throughout these LiveLessons videos.
And, as you're going to see, with tiny amounts of code,
you can create some really cool
and interesting visualizations as well.
And that's going to be really critical
as you start making your way
into big data applications development.
The vast majority of data that we receive nowadays
is so large that no human being
can look at all of that data.
So visualizations become critical
in helping people understand what they're looking at.
As we get into some of the higher-end lessons,
one of the things that we're going to start doing
is talking about the different steps
in a data science study.
So we're going to show you how to obtain data
and prepare it for analysis
and one of the things that we'll do after we obtain data
is get to know that data.
And, in that case,
visualization is often a key aspect
of getting to know your data.
We'll also talk about how to analyze data
using many different techniques.
And, to do that, we're going to be building things
like machine learning models and deep learning models.
And one of the things you will want to be able to do
is to tune those models as well.
And then finally we'll want
to communicate the results of our studies, which once again,
is often going to involve visualizations.
In parts four and five of these LiveLessons videos,
you're going to be working
with many different predefined models
that somebody else creates and trains for you
and then makes available to you
through the various libraries that we'll be importing
and using in our Python applications.
And you're also going to learn how to create your own models
and train them based on data sets that are typically bundled
with the libraries that we'll be introducing,
although you can also download and use other data sets
to train your models as well.
Now throughout those two lessons we're going to look
at all sorts of cool and interesting topics
starting with natural language processing,
then we'll move on to data mining Twitter,
which is one of the most popular big data sources
that are out there and also one
for which natural language processing is commonly used
to perform a technique called sentiment analysis,
where you look at the text of tweets
and you basically determine if they're positive
or negative about a given topic.
And that could be used to do things
like try to predict election results or try to predict
how well a movie is going to do at the box office.
We'll move on to IBM Watson and Cognitive Computing
where we'll build a cool interlanguage translator
using their web services.
We'll also take a look at building your own models
in the machine learning and deep learning lessons.
And then finally we'll finish off with our big data lesson
where we'll cover topics like Apache Hadoop, Apache Spark,
NoSQL databases, and the Internet of Things.
Now that we've talked about all of the different things
that you'll see throughout parts one through five
of these Python Fundamentals LiveLessons videos,
let's talk specifically about what you'll do here
in part one.
We'll start out with a Before You Begin lesson
in which I'm going to talk about
installing the Anaconda Python distribution,
getting the code examples that we provide for you
to execute on your own.
And those code examples, by the way,
are provided in two forms.
You'll find them in source code files
which end with a .py extension
and you'll be able to use those
with the interactive IPython interpreter
or to execute them as what we call scripts in Python.
But we also provide what are known as Jupyter notebooks,
which are interactive web-based notebooks that contain text,
they can also contain images, audio, video,
and live code that you can execute
directly in your web browser.
And you may find that those are actually a really nice way
for you to interact with Python
and learn about the Python programming language as well.
I'll also talk about the two key Python package managers
that you'll use for installing additional libraries
throughout these LiveLessons videos.
As we move on to lesson one,
we'll focus on three test drives
where we'll show you three different ways
to execute the Python code that we provide.
One of which is going to be the IPython Interactive Mode
where you enter either expressions or statements
and interactively execute them.
Another is going to be to use IPython
to execute scripts in their entirety.
So those are full-blown applications
that we'll develop in Python.
And then, finally, we'll do our introduction
to the Jupyter notebooks environment
and show you how to get the environment up and running,
how to load notebooks into Jupyter,
and then how to execute code
within a Jupyter notebook as well.
In lesson two, we're going to start
getting into Python programming fundamentals.
We'll look at basic statements,
show you how to create variables in Python.
And if you're coming
from a strongly typed programming language,
one of the things that you'll see about Python
is that it's dynamically typed so you don't have to state
in advance that a given variable
is going to hold an integer, or a floating point number,
or a string.
It figures all of that out for you
and it's always based on whatever that variable
happens to be referring to at a given time.
We'll look at some basic input and output
as part of lesson two.
We'll also start to show you the various different forms
of strings in Python.
We'll show you, in fact,
three different forms in lesson two,
and a couple of additional ones
in subsequent lessons as well.
And finally, at the end of lesson two,
we're going to start talking about the fact
that everything in Python is an object
and we'll actually demonstrate some of that dynamic typing
I was talking about as well.
In lesson three,
we'll be focusing on Python's control statements,
and this is where you're starting to get a sense
of how small the Python language really is.
It has fewer overall keywords and statements
than most of the other programming languages
that you're probably coming from into Python.
So we'll talk about the if statement
and it's three different forms here.
We'll introduce the only two looping structures
that Python has the for loop and the while loop.
And, as you'll see,
Python does not have a counter controlled for loop.
The one that we'll show you
is for iterating over a sequence.
And as part of that we're going to start
to introduce one of the key data structures in Python,
which is known as a list.
And that's similar to the concept of an array
in other programming languages.
In this lesson we'll also talk
about the augmented assignment operators
and introduce the Boolean operators as well.
In lesson four, we're going to start talking about
how to create your own custom Python function definitions.
Now, one of the things I always try to do
in my LiveLessons videos is compare
and contrast the current language I'm talking about,
in this case Python,
with the other programming languages
that you may be familiar with.
And, in particular,
Python is a C-based programming language.
So you'll find that I will often compare Python
to languages like C, C++, Java, and C# as well.
And one of the reasons I bring that up
is because the way you define functions
in Python is somewhat different
from those other programming languages.
And that's a combination of the fact
that Python uses different keywords
and also the fact that Python
is a dynamically typed language,
whereas those other languages are statically typed.
Now, in this lesson,
we're also going to be talking a little bit more
about how to import libraries
so that you can use them in your applications.
We're going to start to get
into some basic simulation techniques
with random number generation.
We'll talk a little bit about scope
in the context of functions.
And we'll also show you some syntax things
like default parameter values and keyword arguments as well.
Towards the end of this lesson,
we're also going to get into tuples for the first time,
which are another key data structure in Python.
And tuples basically allow you
to aggregate a bunch of related items
which may or may not be of the same type.
And in this lesson, we'll use that capability to demonstrate
how to return more than one value at a time from a function.
Now throughout part one
of these Python Fundamentals LiveLessons videos,
a couple of key things that you're going to see
are a little bit of functional style programming
and the first several of our Intro to Data Science sections.
With regard to functional style programming,
what you're typically going to be doing
is saying what you want to accomplish
not how to accomplish a given task.
And one of the reasons that we're able to do that
is via libraries.
The Python standard library is extensive.
There are a ton of built-in functions
and lots of additional libraries
that you can import and use as well.
And they take this kind of everything
but the kitchen sink approach where,
if there is a common programming task,
chances are there's already a library
that can help you perform that task.
So for instance if I want to calculate the sum
of a list of values, there's a built-in sum function,
which we'll introduce in part one,
that is able to receive a list and give you back that total.
You don't have to figure out how to calculate that total,
the sum function already knows how to do that for you.
And we're going to see lots of different instances
like that as we introduce you to various aspects
of the Python standard library
and other third-party libraries as well.
Now with respect to the Intro to Data Science sections,
our goal is to get you thinking about data science
and various topics related to it
in preparation for the high-end case studies
that you'll be looking at in parts four
and five of these LiveLessons videos.
So in lesson one through four in this part,
we're going to start to introduce some key things
like basic descriptive statistics
and also start talking about getting to know your data
which is going to be a key aspect
of any data science study you perform.