Practical Guide to Python

Nina Zakharenko

Nina Zakharenko

Microsoft
4 hours, 58 minutes CC
Practical Guide to Python

Course Description

This course leverages your experience as a coder in other languages to quickly get you up to speed with writing effective Python. Learn why you might want to use Python and all the foundational basics: data types, numbers, strings, lists, sets, tuples, and dictionaries. We will then cover some practical applications for those python programs, go over libraries and modules, and end the course build in the Django web framework.

This course and others like it are available as part of our Frontend Masters video subscription.

Preview
Close

Course Details

Published: December 22, 2020

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
Get Unlimited Access Now

Table of Contents

Introduction

Section Duration: 28 minutes

Why Python?

Section Duration: 22 minutes

Variables & Data Types

Section Duration: 42 minutes

Functions, Loops, & Logic

Section Duration: 1 hour, 40 minutes

Practical Applications

Section Duration: 24 minutes

Object Oriented Python

Section Duration: 23 minutes
  • Classes vs Instances
    Nina introduces Python classes, and explains the difference between a classes and the instance of a class. All Python data types inherit from a superclass. Within a class definition, the "self" keyword is used to reference the individual instance of that class.
  • Methods & Magic Methods
    Nina uses the @classmethod annotation to define a static method on a class that's shared across all instances. Python classes also have magic methods that are defined with two underscores before and after the method name. Some examples of magic methods are __init__(), __str__(), and __repr__().
  • Inheritance
    Nina shares a brief inheritance example. If a subclass is defined in the same file as its superclass, the class definition should be below the superclass's definition.
  • Tracebacks & Exceptions
    Nina implements exception handling with the "try" and "except" keywords. If an exception is thrown inside the "try" block, the error can be handled inside the "except" block. Multiple "except" blocks can be added to handle specific exception types.

Libraries & Modules

Section Duration: 23 minutes

Web Frameworks

Section Duration: 30 minutes
  • Python Web Frameworks
    Nina introduces the Django and Flask frameworks for Python. Django includes a lot of features out of the box like ORM, user authentication, and content management. Flask allows users to create basic backend APIs easily, but requires third-party packages to extend beyond this basic functionality.
  • Setup Django Blog Project
    Nina installs the Django framework and uses it to create a basic blog application. The migrate command uses the manage.py file to initialize the database. The runserver command starts the local development server.
  • Databases
    Nina explores the Django project and the code that communicates with the SQLite database. Whenever a field is added or removed from the models in Django, the makemigrations and migrate commands should be run to update the database. The Django "shell" command allows models to be worked with in the command line.
  • Views, Routes, & Templates
    Nina explains how Django manages views and routes within the application. HTML templates are returned based on the pattern of the URL. Class-based views are also discussed in this segment.
  • Django Admin
    Nina uses the Django admin interface to manage the content of the blog. The admin can also manage user authentication and permissions.
  • Django Tests & Final Project Practice
    Nina explains why unit tests in Django should inherit from the TestCase class and not the built-in unit test package in Python. This segment also covers the final project practice which involves sorting blog posts and adding an is_draft field.

Wrapping Up

Section Duration: 1 minute

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now