Start with 7 free days of training.

Gain instant access to our entire IT training library, free for your first week.
Train anytime on your desktop, tablet, or mobile devices.

This Python video training course with Ben Finkel covers basic and advanced programming topics using the Python programming language. Python is a platform-independent programming language developed to ease both development time and code legibility. Topics covered in this course include variables and scope, control flow, functions, object-oriented language features, unit testing, error handling, and HTTP serving....
This Python video training course with Ben Finkel covers basic and advanced programming topics using the Python programming language. Python is a platform-independent programming language developed to ease both development time and code legibility. Topics covered in this course include variables and scope, control flow, functions, object-oriented language features, unit testing, error handling, and HTTP serving.

Whether you're new to programming or new to Python, this course has a lot to offer. Python makes for a great introductory programming language due to its ease of use and full-feature set. Experienced developers can get up to speed on one of the most popular languages in use today.

Recommended Experience
  • Basic familiarity with Windows, Linux, or Macintosh
Recommended Equipment
  • A desktop environment with a text editor
Related Job Functions
  • Web developer
  • Software engineer
  • Programmer/analyst
Ben Finkel has been a CBT Nuggets trainer since 2014. His areas of expertise and certifications include Google Developer Expert, Google Certified Trainer, Microsoft ASP.NET (WebForms and MVC), Data Analysis and Design, Relational Database Architecture, MS SQL Server, Microsoft C#.NET, Javascript, jQuery, Microsoft Visual Basic .NET & 6.0, .NET Reporting Services, MS Access, and Python.
 show less
1. Introduction to Python (17 min)
2. Python Basics (18 min)
3. Python Variables (22 min)
4. Input and Output (23 min)
5. If...Then...Else (20 min)
6. Loops (26 min)
7. Collections (25 min)
8. Functions (26 min)
9. Error Handling (19 min)
10. Basic Object-Oriented Programming (29 min)
11. Object Inheritance (22 min)
12. Installing PyQt (on Mac OS X) (12 min)
13. Installing PyQT (on MS Windows) (4 min)
14. PyQt Basics: Getting started with PyQt (11 min)
15. PyQt Basics: Using widgets (11 min)
16. PyQt Advanced: Working with layouts (11 min)
17. PyQt Advanced: Handling events (10 min)
18. PyPI and PiP (7 min)
19. Virtualenv (8 min)
20. Setting up a Simple HTTP Server (11 min)
21. Unit Testing (7 min)
22. Deploying Python on GCE (11 min)
23. Connecting to SQL Databases (12 min)

Introduction to Python


Introduction to Python. Hello, everyone. This is Ben Finkel, and it's time to kick off a new series, looking at the Python programming language. Now, Python has become very popular in recent years, but it actually has a long history. It was developed originally back in 1989, and in 2008, Python 3.0, the third major revision, was released.


It's in use in almost all platforms that you could imagine, and it's very easy and very fast, and it's incredibly readable. It's a really handy programming language to know. It's very practical as well. It's in use in a lot of production environments.


So, if you're new to programming, or if you want to update your skill set, get your resume busted up there, Python is a great technology to pick. Let's get started. All right. So at a very high level, what is Python? Well, generally speaking, Python is a free, open-source, object-oriented programming language.


Now, that doesn't tell us very much. There's a lot of object-oriented programming languages out there. There's a lot of free open-source languages available to us. What are some of the features that set Python apart? Well, for starters, Python is platform independent.


You'll see that you can compile and run Python on any platform imaginable, Linux, Macintosh, Windows, Android, iOS. You name it, if it can execute a program, it can probably run Python. And because it's open source, you can always build a new compiler for any new environment that might come up, so it's incredibly flexible that way.


Python is also very powerful, and this is something that's lost a lot of the time. But Python can be used to underpin a lot of really fast, efficient, powerful programs, and that includes things like graphical applications for video games, or 3D-modeling, or database interfaces, where you need a lot of power and a lot of efficiency.


And Python is fast, not just to execute and run like we talked about, but also to develop, to work with, and maintain. It's an incredibly quick and easy-to-use language that can almost be deceitful in how simplistic it is, because it is very powerful.


And, of course, like we said, it's open source. That means you've got the whole thing available to you as a developer, you can distribute free of charge under an OSI license that the Python Software Foundation maintains. So another question you might have is, what is Python used for?


And the short answer is, nearly anything. It's real popular in web application development. In fact, it ships with a built-in HTTP server library that you can get up and running with a single command. It's super quick to get a quick development HTTP server up and running that you can use for web application development.


And, of course, once you integrate all the various third-party libraries that Python has available to it, you can turn that development server into a full-fledged production web server, and you can serve up an entire production web application right out of Python.


It's also like I mentioned earlier, popular things like game development and database interfaces, the kind of things where you need a powerful, efficient, flexible programming language available to you. So 3D modeling, 3D graphics, large data sets, and database interfaces.


Those kind of things Python is great at and it's very popular to use for those things. More recently it's becoming popular in scientific and statistical analysis as well. You're seeing this a lot in universities and educational centers. It interfaces with packages like SAS and R, so you could perform complex math functions against your data sets that you've pulled down, and you can get out your cool analyses that you need when you're doing this kind of high-end mathematical analysis.


So finally, who's using Python? Well, Python has become very popular in the academic and education arena. Universities are using it. In fact, I believe it's now the number 1 learning language at universities and colleges around the globe. And that, combined with its use in scientific and statistical analysis, which always goes on at a lot of research universities, makes it a big deal in those kind of environments.


But it's also being used in professional enterprise development. It's not only a theoretical language, it's very practical, it's very useful in all sorts of enterprise development, like we talked about. And then it's a real popular language for hobbyist and enthusiast programmers.


Because it's so easy and fast to use, you find that it's a great language to sit down and crank out some real quick code, some real quick programs, when you want to or when you need to. In fact, it's that that I want to stress, because it's a great language to learn programming on.


In fact, as we go through this series, you're going to see that we spent a lot of time talking about the theory of programming, not just practical programming with Python. You want to learn how to program? Python is absolutely a great way to get into that.


So let's start off that learning discussion with taking a quick look at a sort of philosophical question about what type of programming language Python actually is. And, specifically, is Python a programming language or is it a scripting language? Now, you can Google this question, you'll get a ton of results.


The thing to know coming into it is that there is no right answer. There's no right answer for any language. They all fall somewhere on a wide gray spectrum of different definitions, and Python's no different. But I do believe that there are some generally accepted standards among the programming community that we can at least use to help us understand where Python fits into the broader context, into the ecosystem of programming languages that are available today.


So, let's define a couple of end points for this discussion, a programming language versus a scripting language. So programming languages are things like C and C++. And they're generally kind of considered traditional language, although I put that in quotes, because that's not necessarily true.


But it may be what you are familiar with or what you understand a programming language to be. And, for the purposes of this discussion, the key feature of a programming language is it they are compiled ahead of time. When you do help them, and it's that finalized compiled code that's delivered to the client's PC, or the client's computing environment, to be executed.


Now here's what we mean by that. Imagine briefly the steps involved in baking a cake. Now, baking may not seem to have much to do with programming, but actually I think they're pretty similar operations, and you'll find that there's a good analogy to be made here.


To begin with, when you're baking, you start off with your raw ingredients, eggs, butter, et cetera. And those can be thought of as your programming language, also known as a high-level language. Now, the thing about these raw ingredients is, you can't consume them, and just like you can't consume raw eggs, your computer cannot consume raw high-level languages.


Your computer doesn't understand C or C++, or any of the code that you write in. It has to be compiled before it can be consumed by your computer. So the first thing that happens is you mix up all these ingredients together, and you create a batter, and that step can be thought of as linking.


Now, once you've linked all your things together, you've got your batter, then you actually need to put that batter into the oven and create a cake, and this is called your compilation. And this is a really important thing to think about, because when a cake goes into the oven, molecularly it changes.


And when your code gets compiled, it changes dramatically. It turns from this legible high-level language into something we call machine code. And machine code is what your computer can consume. That's what your computer is allowed to eat. So the advantages of this method are we get to write in a high-level language that's somewhat English-like, it's relatively easy to understand, but we still, at the end of the day, compile into machine code, which can be consumed by the computer, and because that compilation step is already done ahead of time, it's usually very fast for the computer to execute machine code.


That's all the computer or the client has to do is execute that machine code. However, this does mean that code is compiled specifically for specific types of machines. If we compile for Windows, it's not going to run Macintosh, and that's an even bigger deal today, with all the variety of different computers that are out there.


It's not just Windows and Macintosh, it's Android and iOS, Linux, and it's all very popular. So, the alternative, the other side of that coin, is scripting languages. And scripting languages are often called interpreted languages, and you can think about things like JavaScript as maybe the most popular scripting language right now.


Now, at the end of the day, scripting languages and programming languages have to do the same thing. They have to end up as machine code to be executed on a machine, but here's the difference. In a scripting language, typically, you write your high-level language here, when you're developing, and then that's the end of it.


You actually ship the entire rest of the process down to the client PC. So all of this is happening on your client. And that means that you're sending out raw code, raw scripting language, that is getting linked, compiled, executed in real time, right on the machine itself.


Now, this has the neat advantage of being pretty much totally platform independent. Any platform that has an interpreter for that particular scripting language, and if you take something like JavaScript, that interpreter is built right in your web browser.


Every computer has a web browser. Then, every computer is going to be able to read your code, as the developer, you don't have to worry about who's using your code, you just ship it off, and it's going to get interpreted by the computer correctly. The downsides to that are, generally speaking, you expect a performance degradation, because both the compilation and the execution have to happen at run time, after that code has been sent down to the client.


And also there's a bit of a security concern. You're shipping raw, blank source code down to your clients. If somebody wanted to steal your source code, they would be able to steal your source code. So, which one of these two things is Python? Well, sorry to break it you, but Python is neither.


There's an increasingly popular collection of programming languages that could maybe be called intermediate languages, things like Java and dot NET and Small Talk, that are in between programming and scripting. They exist in the middle of the spectrum that I talked about earlier.


And I like to think of these as par-baked languages. So, and if you've ever picked up a par-baked loaf of bread, you know that it's kind of halfway made for you, but you still get to take it home and finish the baking process yourself. These are the same kind of thing, dot net, Java, Small Talk, and Python.


And what happens here is that these get compiled and linked, not into machine code, but into something that is often called byte code. And the idea here is that a lot of the compilation, the optimization happens ahead of time on the development machine, just like with a programming language.


But, because you're not turning it into machine language, the byte code that you're sending out to your clients is still platform independent. It can still run, like a scripting language, like an interpreted language, on any machine that has an interpreter built for it.


So you're kind of trying to take the best of both worlds and create this intermediate language, and this is what Python is. Python is a byte code, compiled language. That means that anyone who's going to execute your Python programs needs to have an interpreter, a Python interpreter, on their PC.


Now, if this didn't make too much sense to you, or you're new to all these concepts, don't worry about it too much. It'll become a lot more clear as we work through the series. For the most part, we're going to be working locally on our development machine and executing our code right there, inside of our development environment, so we're not even going to have to worry about compilation and those kinds of things.


It's really only important when you're distributing code, and it's kind of an advanced topic. But, with that mind, let's take a look at what we are going to go over in this course. Over the course of this series, we're going to touch on a lot of different topics with these Nuggets.


It's going to be a really broad approach, but also very deep approach, to the world of Python. Now, we want this series to be good for brand new programmers, so with that in mind, we're going to go ahead and take a look first at what I like to call the basic stuff.


This is the stuff that's new for programming, that you need to learn and you need to understand, regardless of what programming language you're going to be working with. These are really basic foundational pieces. We'll start with variables and variable scope.


That's how you store information in memory, so that you can recall it later inside of your program, perform calculations against it, et cetera. It's really important for any programming language, and going back to my cake-baking analogy, variables are almost the molecules inside of the cake, they are that low level.


After that, we want to take a look at input and output, and like it sounds, input and output is how you get information from the user, or from the file system, from some external source, and output is how you display it out to the user, print it out to the page, send it off to an external source.


So input and output is really important. That's how you get different information into and out of your program that, combined with your variables, frequently changes how your program operates and how it functions. That's what makes programming great, is that different input can produce different output.


It's logically malleable, is the word we use. Then we'll take a look at control flow statements, inside of Python, and these are if-then else statements and while loops, and that's how you can control the flow of the statements inside of your program application.


We'll take a look at functions and how you define and use those inside of Python. Functions are another really important concept for programming. Functions allow you to group statements together in chunks of reusable code, so you can define a really complex operation once, and then reuse it throughout your program multiple times.


If variables are the molecules inside of those ingredients, functions themselves are the ingredients. That's your eggs and your butter that's going into your cake, the really, the meat, of your software, of your program. And then lastly, an ever important topic in programming, we're going to take a look at error handling.


It's not a very sexy topic. Programmers, a lot of times, don't like to deal with error handling, but it's really important to get good error-handling structure inside your code at a low level, so we want to introduce that right off the top. Now, if you're not a brand new programmer, but you're an experienced programmer who's new to Python, you should also find these topics really helpful.


We're going to make sure to take a really deep dive into each one of them, so that even if you understand what variables and variable scope are, you're going to have a really solid understanding of how you work with them inside of Python, and what the implications are throughout your entire program when you're doing these things Once we've completed the basic stuff, we're going to move on to the advanced topics, and the advanced topics are going to cover a lot of different things.


We want to start with object-oriented concepts, take a look at how we can produce object-oriented code, which Python is an object-oriented language. And we're going to take a look at some of the basic object-oriented structures that you can get inside of a program, that's classes, inheritance, a few other things.


Then we'll spend some time looking at how you can use Python to create user interfaces. That's always an important part of any application. No one wants just a plain old tech screen that they key into. People want buttons, they want to scroll bars, they want user interface elements.


Well, we'll take a look at how to create those with Python. We've got a Nugget on HTTP serving, that's creating a file server, an HTTP file server, inside of Python. It's really easy to do, and you have a lot of flexibility when you do that. We'll also take a look at how to perform unit testing against your Python programs.


This is another really important concept, along with error handling. No one likes to do it, but you've got to test your code. Especially today, it's so important to make sure that you've tested your code before you hand it off to any other member of your team.


This course will also be good for anyone who needs a refresher on any of the topics contained within the Nuggets. The Nuggets are a freestanding unit, so you don't have to watch them like your binge watching a series on Netflix, you can simply pick and choose the topics that you want to learn about, and watch only that Nugget.


Now, the concepts do build over the course of this series, so you need to be familiar with the things that are introduced in the previous Nuggets, but you don't have to have seen those Nuggets in order to get the most out of any one particular Nugget.


Lastly, let's talk quickly about the tools that we're going to use in the series, and that's really going to be very simple. We're going to use Python 3.4.1. That's the latest version of Python that's out, as of the recording in this video. And we're going to use a text editor.


I'm going to use Sublime, but you can use any text editor of your choice. Sublime, Notepad, VI, Emacs. There's also a lot of great Python-specific IDEs out there that you can use to edit your text. That's the thing to remember, where writing code is that at the beginning it's just straight text, so you don't need anything fancy to do this.


That concludes our introduction to Python. Just a quick review of what we talked about. We looked at what Python is. It's an open-source, platform-independent programming language that's in use in just about every industry and field we can imagine. It's also available on just about every platform that we can imagine.


It's incredibly terse and incredibly readable, and it's a really good programming language to add to your own personal skill set. We also talked about how you compile Python code, how it compiles in a par-baked manner to byte code, which is then finally compiled on the client operating system, or on the client machine, by some sort of interpreter.


So it's not quite a full fledged, fully compiled programming language, but it's not quite a scripting language, either. It exists really in the middle of that big wide spectrum of possibilities. And then lastly, we finished up by taking a look at some of the basic and advanced topics that we're going to cover over the course of this series, that was by no means a complete, exhaustive list, but it hit the highlights.


This is going to be a fun series. I'm really looking forward to it, and I hope you are, too. I hope this has been informative for you. And I'd like to thank you for viewing.

Python Basics

Python Variables

Input and Output





Error Handling

Basic Object-Oriented Programming

Object Inheritance

Installing PyQt (on Mac OS X)

Installing PyQT (on MS Windows)

PyQt Basics: Getting started with PyQt

PyQt Basics: Using widgets

PyQt Advanced: Working with layouts

PyQt Advanced: Handling events

PyPI and PiP


Setting up a Simple HTTP Server

Unit Testing

Deploying Python on GCE

Connecting to SQL Databases

Please help us improve by sharing your feedback on training courses and videos. For customer service questions, please contact our support team. The views expressed in comments reflect those of the author and not of CBT Nuggets. We reserve the right to remove comments that do not adhere to our community standards.

comments powered by Disqus
Intermediate 6 hrs 23 videos


Training Features

Practice Exams
These practice tests help you review your knowledge and prepare you for exams.

Virtual Lab
Use a virtual environment to reinforce what you are learning and get hands-on experience.

Offline Training
Our iOS and Android mobile apps offer the ability to download videos and train anytime, anywhere offline.

Accountability Coaching
Develop and maintain a study plan with one-to-one assistance from coaches.

Supplemental Files
Files/materials that supplement the video training.

Speed Control
Play videos at a faster or slower pace.

Included in this course
Pick up where you left off watching a video.

Included in this course
Jot down information to refer back to at a later time.

Closed Captions
Follow what the trainers are saying with ease.
Ben Finkel
Nugget trainer since 2014