O'Reilly logo
live online training icon Live Online training

Learning Python 3 by Example

A thematic and demonstration-oriented course to teach effective programing using Python 3.

Topic: Software Development
Nicholas Russo

Python is a popular programming language used for quick scripts, production software, and everything in between. Participants will master the core computer science techniques to build a concrete foundation for future Python studies and development. Nick Russo teaches each technique using realistic and contextual examples (you won’t see fluff words like ‘foo’ and ‘bar’ here). The course concludes with a detailed analysis of all the techniques rolled into a complete Python application. This course mixes static content with several hands-on demonstrations, making it different from other forms of training.

The course has two main blocks. The first block contains a Python refresher, exploration of fundamental tools, techniques, and data structure. It concludes with a detailed analysis of a small program demonstrating these features. The second block introduces intermediate techniques, including object-oriented programming and file handling. These build upon the fundamentals, and the section concludes with a detailed analysis of the complete sample program. As a bonus, participants will learn about software testing and retroactively add some tests to the existing program.

After this course, participants will be able to write, troubleshoot, and test custom applications that interact with structured data files, such as JSON and YAML, and turn them into meaningful objects through object-oriented programming. Participants will be able to enhance their existing Python code with error/exception handling, functional decomposition, and unit testing. Participants will learn the tools to create applications using hierarchical data structures, such as IP prefix representation (networking) or employee management systems (resource planning).

What you'll learn-and how you can apply it

  • Master the fundamental Python operations and optimizations
  • Interact with structured data and design custom objects
  • Learn to analyze Python code for proper operation
  • Deliver high-quality code through testing
  • Develop useful and reusable applications through abstraction

This training course is for you because...

  • You are new to Python, but have entry-level computer science knowledge
  • You are a highly experienced non-Python programmer


  • In terms of Python skill level, you should be around a 2 or 3 out of 10. Participants should have a bit of Python exposure but this course refreshes the fundamentals.
  • Basic computer science knowledge, such as being able to give generic definitions of things like variables, operators, functions, conditionals, and loops.
  • Basic understanding and identification of YAML and JSON data formats
  • Basic git skills (just enough to clone the repository before the course)
  • Introduction to Python (the entire course) or pre-existing comparable knowledge: https://www.safaribooksonline.com/library/view/introduction-to-python/9781491904794/

Recommended Preparation

  • Access to a computer with Python 3.6 or newer installed. The author will be using Python 3.6.
  • Access to the user’s IDE of choice, or a simple text editor. The author will be using vim.
  • Administrative rights to install software packages on whatever development platform is used. The author will be using a Macbook pro.
  • Participants are encouraged to clone the git repository: https://github.com/nickrusso42518/slt-py-example

Recommended Follow-up

About your instructor

  • Nicholas Russo holds a Bachelor’s of Science in Computer Science from the Rochester Institute of Technology (RIT). His primary programming experience is in C# and Java, but has been programming almost exclusively in Ansible and Python over the past several years. Nick’s day job is an automation-focused network engineer but he loves teaching others about technology. Nick lives in Maryland, USA with his wife, Carla, and daughter, Olivia.


The timeframes are only estimates and may vary according to how the class is progressing

Python Introduction (35 mins)

  • Instructor will review the core Python components, such as major versions, modules, packages, and how the language works at a basic level. It also includes data types, operators, and collections. It also includes writing output to the console and collecting user input.
  • Participants will know immediately whether this is the right course for them. If all the prerequisites are complete, then this should be a refresher. For those less familiar with Python, this section should reinforce the core concepts from which all Python development is based.

Fundamental Techniques (35 mins)

  • Instructor will introduce some of Pythons most commonly used and critical features including conditionals, iteration (loops), slicing, functions, and error/exception handling.
  • Participants will finish this section fully capable of writing simple Python programs on their own, ideally to solve their business problems.

Break (length: 10 min)

Fundamental Programming Exercise (25 mins)

  • Instructor will build a minimalist program using the techniques learned thus far to reinforce the core components of Python. This section is focused around student interaction and Q&A to drive a deeper understanding of the concepts previously covered.
  • Participants will finish this section fully capable of writing simple Python programs on their own, ideally to solve their business problems.

Intermediate Techniques (25 mins)

  • Instructor will introduce list comprehensions, decorators, and troubleshooting techniques to optimize Python code. Because these techniques are more challenging, the instructor will use simple examples to illustrate their use without digging too deep. Integrated with this section will be continuous remediation of the fundamentals, since the intermediate techniques are built on top.
  • Participants will learn how to employ these tools to improve their code, whether it is optimizing for performance, reducing clutter for readability, or repairing a complex issue.

Break (length: 10 min)

Object-Oriented Programming (OOP)(20 mins)

  • Instructor will introduce the concept of OOP including its most powerful uses: inheritance, abstraction, and polymorphism. The instructor will break down these seemingly complex terms into simple, relatable examples.
  • Participants will understand the power of using objects in their code to create easy to use libraries and code bases for their coworkers and customers.

File Input/Output (I/O) (15 mins)

  • Instructor will read and write YAML and JSON in Python using a variety of methods and give recommendations on the best techniques. Because file I/O can be inherently dangerous, the instructor covers error handling as well.
  • Participants will learn how to consume structured data into Python ... and will be surprised at how easy and effective it is! Participants will see the value of specifying data in structured form rather than raw text, and should find ways to integrate this into their daily work.

Break (length: 10 min)

Full Program Review (35 mins)

  • Instructor will walk through an entire program comprised of excerpts from the entire course. This includes all of the subtopics discussed thus far, which have all followed a common theme of geometric shapes. This program is the combination of the fundamental demonstration and the new intermediate technologies.
  • Participants will consolidate their gains in knowledge by seeing all the pieces of the puzzle fit together and working in harmony. The course results in a functional piece of software for students to use as a base for future development.

Break (length: 5 min)

Unit Testing (25 mins)

  • Instructor will present two different Python test frameworks: unittest and pytest. Instructor will stress the importance of testing with real world examples using both techniques. This block ends with enhancing our full program with unit tests, then ensuring our code is functioning correctly.
  • Participants will learn how to use a variety of Python test tools to produce high quality, bug free code. Participants will understand how to connect the importance of testing back to business goals.