Microsoft
Course Description
Understand key python features for building real-world Python applications! In this course, you'll use list comprehensions to manipulate large quantities of data. You'll learn the basics of how Python implements Object Oriented Programming. Also learn how to approach error handling, external libraries and modules, and use a web framework to build a Python web application.
This course and others like it are available as part of our Frontend Masters video subscription.
Preview
CloseCourse Details
Published: May 1, 2019
Learning Paths
Learn Straight from the Experts Who Shape the Modern Web
Your Path to Senior Developer and Beyond
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Introduction
Section Duration: 27 minutes
- Nina Zakharenko introduces herself, and reviews the system requirements as well as the tools that should be installed for the course.
- Nina reviews how to run code in the Python REPL.
- Nina introduces what will be learned in the class, and looks at the final project that will be built.
- Nina reviews the Python philosophy, then shows a few fun easter eggs built into the language.
- Nina introduces the split and join methods that manipulate strings based on a delimiter.
- Nina walks through the practice segment.
Comprehensions
Section Duration: 57 minutes
- Nina demonstrates how to create lists recursively.
- Nina demonstrates to utlilize if statements within list comprehensions, and reviews truthy and falsey statements.
- Nina reviews how to manipulate string values with sum(), min(), max(), and sorted().
- Nina demonstrates how to create sets and dictionaries recursively.
- Nina explains how to create generator comprehensions (expressions).
- Nina reviews how to select a slice of a list, and how lists are assigned in memory when renamed.
- Nina introduces the zip function as a way to create an array of tuples from two separate lists.
- Nina walks through the practice where students manipulate data structures using comprehensions, slicing, and the zip Function.
OOP
Section Duration: 1 hour, 12 minutes
- Nina introduces what object oriented programming is, and what it means for the Python language.
- Nina introduce classes, and how the self keyword is used inside classes to refer to a bound instance variable or object.
- Nina introduces an example to illustrate how an instance of a class allows the user to call methods on the class that only refer to the bound instance.
- Nina introduces the __init__ (intializer method) as a way to invoke attributes when a class instance is instantiated.
- Nina introduces the class method, which is able to access the class variables on the type, rather than the instance.
- Nina reinforces what was learned by testing knowledge about what types different objects are, and introduces a function that checks if an object is a particular instance of a class (or subclass of the class). all() and any() are also briefly covered.
- Nina introduces two methods that communicate details about the instance of the class, and the code needed to recreate this object.
- Nina introduces inheritance as a way to create types that have shared attributes. How a subclass inherites from the parent (or super) class is demonstrated, as well as how to utilize the super() function as it is implimented in Python3 to call specific methods from the parent class.
- Nina live-codes the practice where classes and class instances are reviewed.
- Nina live-codes the practice where subclasses and the super keyword are reviewed.
- Nina writes a class that returns data about Github repositories, and reviews when to use the magic methods covered in an earlier section.
Exceptions
Section Duration: 34 minutes
- Nina introduces basic exception types that can be thrown when an error occurs, and why it's important to add them in order to write robust, and maintainable programs.
- Nina demonstrates how to use an try except exception statement that prints out a helpful message to the user if an error is thrown.
- Nina demonstrates why error order matters. Students are also warned against "swallowing the exception".
- Nina demonstrates how to creat and raise custom exceptions to signal error conditions in production code.
- Nina implements a custom exception in the Github API project that was started in Intro to Python.
- Nina live-codes the practice where syntax errors, custom exceptions, and other exception topics from previous sections are reviewed.
Libraries & Modules
Section Duration: 25 minutes
- Nina explains how the "batteries included" way of having much functionality already included in the standard library helped Python's early success. An introduction to what's available in the standard library is also covered, as well as its drawbacks.
- Nina demonstrates how to start a custom library, as well as best practices when importing modules, and naming imported modules with aliases.
- Nina discusses how to ensure that the correct version of pip is being utilized to download a package, and security concerns over installing mistyped packages.
- Nina reviews how to interact with several common packages, utilizing the 'as' keyword, and introduces how to use content manager.
- Nina introduces how to take only necessary arguments from the arguments collected using slicing, and how to ask for input from the user.
Testing
Section Duration: 18 minutes
- Nina gives an introduction to unit tests, integration tests, and functional tests. The 'assert' keyword's functionality is also demonstrated as a sanity check.
- Nina demonstrates how to write a unit test, how to write error messages for when the test doesn't pass, and how to run the test file from the command line as well as how to pass flags to get different output.
- Nina shows the full list of TestCase assertions, and mentions the external libraries that can be explored when the standard Python testing library falls short.
- Nina live-codes the testing practice that reviews unit test principles that were covered in the last few sections.
Web Frameworks
Section Duration: 38 minutes
- Nina introduces several commonly used Python frameworks, including Django, Pyramid, and Flask.
- Nina demonstrates how to start a Flask app.
- NIna demonstrates how to add routes to the app, and also how to pass in a flag that reloads the app every time there is a saved change.
- Nina demonstrates how to begin using the templating system in Flask, and gives resources for those wanting to continue learning about Flask.
- Nina prepares the audience to go through the last exercise of the course.
- Nina walks through the result of the Flask app practice.
- Nina summarizes what was learned while doing the Flask app practice, and thanks the audience for coming.
Wrapping Up
Section Duration: 1 minute
- Nina concludes the course by offering several resources to continue learning.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops