Core Python

Paths

Core Python

Authors: Jason Olson, Austin Bingham, Robert Smallshire, Tom Bell, Sarah Holderness, Hugo Valle, Nicolae Caprarescu, Jon Flanders, Axel Sirota

Python is an interpreted, high-level, general-purpose programming language that emphasizes code readability. It’s a dynamically typed and garbage-collected language that supports... Read more

  • Python use cases
  • Code organization
  • Classes and functions
  • Object oriented design
  • Iterators and collections
  • Error handling
  • Introspection
  • Numeric tower
  • Hasing
  • Generators
  • Coroutines

Pre-requisites

None

Core Python

Python is an interpreted, high-level, general-purpose programming language that emphasizes code readability. It’s a dynamically typed and garbage-collected language that supports structured, object-oriented, and functional programming. It’s often described as a "batteries included" language due to its comprehensive standard library. In this path you will learn the basics of Python and more advanced topics such as object-oriented design and code organization.

Python: The Big Picture

by Jason Olson

Jan 26, 2018 / 1h 5m

1h 5m

Start Course
Description

At the heart of creating software is being able to use the right tool for the right job. In this course, Python: The Big Picture, you'll learn about the Python programming language. First, you'll learn what Python is, what makes it different, and why you should care. Next, you'll explore the different ways Python is being used to develop different types of applications today. Finally, you'll discover how to get started working with Python code and what next steps you can take in your Python journey. When you're finished with this course, you'll have a foundational knowledge of Python that will help you as you move forward to recognizing when Python is the right tool for any future jobs you are faced with as a software developer.

Table of contents
  1. Course Overview
  2. What Is Python?
  3. When and Where Is Python Being Used?
  4. First Steps with Python
  5. Continuing Your Python Journey

Core Python: Getting Started

by Austin Bingham

Dec 12, 2019 / 4h 5m

4h 5m

Start Course
Description

Python is a big language, and it's important to have a thorough grounding in its key concepts in order to be productive and create high-quality Python programs. In our experience, starting off in the right direction and avoiding early misconceptions is crucial to success with Python, and that's the kind of start we aim to provide. In this course, Core Python: Getting Started, we are going to introduce you to the essentials of the Python language as well as important parts of the Python standard library. Some of the major topics that we will cover include: Python's fundamental data types, using functions and modules to organize your code, Python's underlying object model, defining your own types using classes, and working with iteration and iterable objects. By the end this course, you'll have the skills and knowledge to work on almost any Python project, and you'll be in a great position to continue learning more advanced aspects of the language.

Table of contents
  1. Course Overview
  2. Installing and Starting Python
  3. Scalar Types, Operators, and Control Flow
  4. Introducing Strings, Collections, and Iteration
  5. Modularity
  6. Objects and Types
  7. Built-in Collections
  8. Exceptions
  9. Iteration and Iterables
  10. Classes
  11. File IO and Resource Managements

Core Python: Organizing Larger Programs

by Austin Bingham

Mar 8, 2019 / 1h 5m

1h 5m

Start Course
Description

As your Python programs grow, or you contribute to existing, larger Python-based systems, you'll need some techniques to help you manage the inevitable growth of complexity. In this course, Core Python: Organizing Larger Programs, you’ll learn foundational knowledge to structure your Python programs to facilitate their growth and maintenance. First, you'll learn how to implement packages. Next, you'll discover namespace and executable packages. Finally, you'll explore a structure for your projects that support everything from code to tests to documentation. When you’re finished with this course, you’ll have the skills and knowledge of Python program organization needed to grow and nurture your Python projects.

Table of contents
  1. Course Overview
  2. Nesting Modules with Packages
  3. Implementing Packages
  4. Namespace and Executable Packages
  5. Recommended Package Layout
  6. Package Distribution

Core Python: Classes and Object-orientation

by Robert Smallshire

Jun 2, 2020 / 2h 54m

2h 54m

Start Course
Description

Classes are crucial tool in Python for organizing data and behavior. In this course, Core Python: Classes and object-orientation, you’ll learn how to apply fundamental principles of Object-Oriented Programming (OOP) in Python. First, you’ll learn how to distinguish between classes and instances, and define attributes on both. Next, you’ll explore properties using them to encapsulate state. Finally, you’ll discover how to combine classes using inheritance and multiple inheritance, and have these classes collaborate in ways which are distinctive to the Python language. When you’re finished with this course, the will have the skills and knowledge of the core Python language needed to develop larger and robust software systems.

Table of contents
  1. Course Overview
  2. Class Attributes, Methods, and Properties
  3. String Representation of Objects
  4. Multiple Inheritance and Method-resolution Order
  5. Class Decorators
  6. Data Classes
Project

Build a Static Site Generator with Python

by Tom Bell

Apr 30, 2020 / 2h 20m

2h 20m

Start Project
Description

Python is great for building simple command line applications. In this project you’ll use classes to architect a command line static site generator.

Project overview
  1. Setup1h
  2. The Site Class20m
  3. The Parser Class20m
  4. The Content Class20m
  5. Parser Subclasses20m

Core Python: Functions and Functional Programming

by Austin Bingham

Mar 3, 2020 / 1h 17m

1h 17m

Start Course
Description

In Python, as with most programming languages, functions are a fundamental tool for managing program complexity. Understanding how to use functions fluently is a key skill on the road to mastering Python, as is knowing alternative techniques for the cases where functions are insufficient for your needs. In this course, Core Python: Functions and Functional Programming, you'll learn about some of the finer details of using functions as well as more general concepts that subsume them. First, you'll look at the various types of callable objects in Python, along with extended argument definition and calling syntax. Then, you'll explore local functions and the concept of closures that allow them to work. Next, you'll discover Python's powerful system of decorators which allow you to enhance or modify existing functions. Finally, you'll understand the functional-style programming tools in Python along with advanced use of comprehensions. By the end of this course, you'll have a deeper understanding of Python's sophisticated approach to calling functions, and you'll see that functions are actually just one aspect of a more general set of concepts in the language.

Table of contents
  1. Course Overview
  2. Function and Callables
  3. Extended Argument and Call Syntax
  4. Closures
  5. Function Decorators
  6. Functional-style Tools
  7. Multi-input and Nested Comprehension
Project

Add Extensions to a Static Site Generator with Python

by Tom Bell

May 28, 2020 / 1h 10m

1h 10m

Start Project
Description

Python is great for building simple command line applications. In this project you’ll use function decorators to architect an extension system.

Project overview
  1. Setup15m
  2. Load Extensions15m
  3. Event and Filter Hooks15m
  4. Menu Extension15m
  5. Stats Extension10m

Core Python: Implementing Iterators, Iterables and Collections

by Austin Bingham

Jul 28, 2020 / 2h 14m

2h 14m

Start Course
Description

Collections in Python are organized according to a scheme of protocols such as Container, Iterable, and Sequence. In this course, Core Python: Implementing Iterators, Iterables and Collections, you'll understand how the built-in collections are situated in this scheme. First, you'll discover how collections support different protocols and how those protocols work together to produce powerful, and yet easy-to-use collections.

Next, you’ll learn how to design and code new iterators for existing collections, and for whole new collections that meet your specific needs, by following a process of test-driven development. Finally, you'll learn how to optimize collections for performance, so new collections can be both correct, and fast.

When you’re finished with this course, you’ll gain a deeper insight into how Python works beneath the surface.

Table of contents
  1. Course Overview
  2. Iterators and Iterables
  3. Collection Protocol Overview
  4. The Collection Construction Convention
  5. The Container Protocol
  6. The Sized Protocol
  7. The Iterable Protocol
  8. The Sequence Protocol
  9. Refactoring to Improve Performance
  10. The Collection Abstract Base Classes
  11. The Set Protocol
Project

Build a Personal Budget Report with Python Collections and Iterables

by Sarah Holderness

Jun 2, 2020 / 2h 40m

2h 40m

Start Project
Description

In this project we're going to create different budget reports for our spending data using Python collections, iterables, and iterators.

Project overview
  1. Setup10m
  2. Count Expenses by Category30m
  3. Create the BudgetList class to Display Budget Overages30m
  4. Finish Making BudgetList an Iterable30m
  5. Categorizing expenses into separate sets30m
  6. Timing Set Comprehension and Plotting Categories30m

Core Python: Robust Resource and Error Handling

by Austin Bingham

Jun 29, 2020 / 1h 14m

1h 14m

Start Course
Description

The dominant error handling strategy in Python is the use of exceptions, and exceptions are ubiquitous in the Python language, standard library, and package ecosystem. In this course, Core Python: Robust Resource and Error Handling, you’ll understand how to work with exceptions in Python. First, you’ll be introduced to context managers, Python’s facility for safely and automatically managing resources. Next, you'll see how larger systems often benefit greatly from more sophisticated exception handling strategies. Finally, you'll discover how to model database transactions. When you're finished with this course, you’ll know how to chain associated exception together, define your own exceptions, and define and deploy context managers.

Table of contents
  1. Course Overview
  2. Review
  3. Exception Hierarchies
  4. Exception Payloads
  5. User-defined Exceptions
  6. Exception Chaining
  7. Tracebacks
  8. Assertions
  9. Context Managers
  10. The Context Manager Decorator
  11. Multiple Context Managers in a With-Statement
  12. Example: Modeling Database Transactions with Context Managers

Core Python: Introspection

by Robert Smallshire

May 13, 2020 / 30m

30m

Start Course
Description

Python is a highly dynamic language, and this dynamism is enabled by a great deal of metadata associated with objects at runtime. In this course, Core Python: Introspection, you'll explore Python's support for introspection, the ability of a program to examine - and even modify - its own structure and state through this metadata.

First, you'll look at introspection as the key to elegant designs or debugging complex problems. Then, you'll be introduced to Python’s facilities for introspecting live programs. Finally, you'll learn how to examine objects, types, and program state at runtime. By the end of this course you’ll know how to query objects for their attributes and inspect program state, and you’ll have a deeper knowledge of how Python programs are arranged internally.

Table of contents
  1. Course Overview
  2. Introspecting Types
  3. Introspecting Objects
  4. Introspecting Scopes
  5. The Inspect Module
  6. An Object Introspection Tool

Core Python: Numeric Types, Dates, and Times

by Austin Bingham

Mar 10, 2020 / 55m

55m

Start Course
Description

Python’s basic numeric types, int and float, are generally intuitive and are often sufficient for most programming tasks. There are some calculations, however, for which these types aren’t the right tool, and numeric types with different qualities are called for. In this course, Core Python: Numeric Types, Dates, and Times, you’ll take a look at some of the other numeric types that Python provides. First, you’ll look at the Decimal, Fraction, and complex types, and you'll discover when they should be used and how to use them. Next you’ll review some functions that can be used with many or all numeric types. Then you’ll see how to work with dates and times using Python’s datetime package. Finally, you’ll learn about a practical example where using the right numeric type makes a big difference. When you’re finished with this course, you’ll have a better understanding of how to apply Python’s standard numeric types and perhaps a deeper appreciation for numerical programming in general.

Table of contents
  1. Course Overview
  2. Review of int and float
  3. The Decimal Module
  4. The Fractions Module
  5. Complex Numbers
  6. Built-in Functions Relating to Numbers
  7. Dates and Times with the Datetime Module
  8. Computational Geometry
Project

Decoding Sensor Data Using Python

by Hugo Valle

Jun 2, 2020 / 1h 40m

1h 40m

Start Project
Description

Data is being generated all the time by the IoT devices around us. Python is a great tool to analyze this data. In this project, you will learn some of the Python data types and modules to read, interpret, and convert data from one form to another. Users will also learn how to work with date timestamps.

Project overview
  1. Setup10m
  2. Sensor Data Files: Load Raw Data20m
  3. Home Data Class20m
  4. Analyze Temperature Data15m
  5. Analyze Humidity & Air Quality Data20m
  6. Analyze Energy Consumption Data15m
Project

Build Your Own CLI Planner App Using Python Abstract Base Classes

by Nicolae Caprarescu

May 19, 2020 / 3h

3h

Start Project
Description

In this Project you’ll follow along with our step-by-step instructions and build your own Planner application using Core Python. You’ll create several classes, modelling the different types of reminders in this application, mastering concepts such as Abstract Base Classes, Proper Base Classes, and Virtual Base Classes.

Project overview
  1. Setup1h
  2. Build Your App2h

Core Python: The Numeric Tower, Conversion, and Operators

by Matt Harrison

Jul 31, 2020 / 1h 4m

1h 4m

Start Course
Description

There are many reasons that you would need to use numbers or complex math in a software development scenario. For example, Python can be used to quickly count currency, calculate camera aperture, and create fractals. In this course, The Numeric Tower, Numbers, and Operators, you’ll learn how numbers work behind the scenes. First, you’ll explore the built-in number types. Next, you’ll discover how the operators work. Finally, you’ll learn how to implement operators on your objects. When you’re finished with this course, you’ll have the skills and knowledge of numbers and protocols needed to leverage operators and custom classes.

Table of contents
  1. Course Overview
  2. Numeric Types
  3. Implementing Classes that Respond to Operators

Core Python: Hashing and More Collections

by Jon Flanders

May 12, 2020 / 1h 33m

1h 33m

Start Course
Description

Whether you are writing scripts for your own use, building websites with something like Flask, or using machine learning frameworks like TensorFlow, you need to use collections in Python. However, often there are multiple collection types that seem like the correct solution to your particular problem. Being able to pick the correct type is an essential skill to write effective Python code. In this course, Core Python: Hashing and More Collections, you will learn about more of the collection types in Python and be able to pick the correct type and use that type more effectively. First, you will learn how to classify collection types to be able to easily determine what kind of functionality all the advanced collection types offer. Next, you will discover how to implement hash and eq to make your own types more useful in mapping types. Finally, you will explore more of the collection types in Python. When you are finished with this course, you will have the skills and knowledge of Python collection types needed to write more effective Python.

Table of contents
  1. Course Overview
  2. Collections by Type
  3. Custom Object equality: __hash__ and __eq__
  4. More Mapping Types
  5. More Sequence Types

Advanced Generators and Coroutines

by Axel Sirota

Feb 20, 2020 / 1h 49m

1h 49m

Start Course
Description

Life is about waiting, so how about for once letting Python wait for you? Generators and coroutines are Python's main ingredients for lazy programming and letting code run concurrently in the same thread. In this course, Advanced Generators and Coroutines, you will learn foundational knowledge of generators and coroutines in Python. First, you will learn generators. Next, you will discover how generators can be chained in complex data pipelines. Finally, you will explore how to run code concurrently and single-threaded with coroutines and event loops. When you’re finished with this course, you will have the skills and knowledge of generators and coroutines needed to make features run concurrently and optimized easier than ever before.

Table of contents
  1. Course Overview
  2. Much More Than Just Iteration: Generators!
  3. Creating Your First Generator Based Data Pipeline
  4. Meet Generators Counterpart: Coroutines
  5. Pushing Data through Pipelines with Coroutines