O'Reilly logo
live online training icon Live Online training

Getting started with Python 3

Learn the basics by building a Markov chain generator

Topic: Software Development
Matt Harrison

At the moment, there's a huge demand for Python skills. Whether you're a recent grad or an industry veteran, there's no better time to learn this popular language.

In this two-day hands-on course, expert Matt Harrison introduces Python fundamentals in a slightly nontraditional manner—by walking you through building a Markov chain generator, the technology behind spelling and word suggestions. As you build out the basic functionality, you'll explore Python features such as classes, functions, looping, variables, and basic data structures. By the end of this course, not only will you have created a Markov chain generator from scratch; you'll also have a deep understanding of Python and the features that make it so popular.

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

By the end of this live online course, you’ll understand:

  • Python's ethos and basic concepts, features, and techniques
  • How Python is different than other languages
  • Where to get help when you get stuck

And you’ll be able to:

  • Use Python to write functions, classes, and simple tests
  • Deal with files
  • Use the Python interpreter

This training course is for you because...

  • You're an experienced programmer in any language and would like to quickly get up to speed with Python.
  • You've been using Python for a while but want to better understand fundamental concepts and techniques.


  • Comfort programming in at least one other language

Required materials and setup:

  • A machine with Python 3.6 (or above) installed and the ability to run IDLE. IDLE is a Python editor that ships with Python. (Run python3 -m idlelib.idle. Note that on Windows you need to open the Command Prompt and run: python -m idlelib.idle)

Recommended preparation:

Course Materials:


About your instructor

  • Matt runs MetaSnake, a Python and Data Science training and consulting company. He has over 15 years of experience using Python across a breadth of domains: Data Science, BI, Storage, Testing and Automation, Open Source Stack Management, and Search.


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

Day 1

Introduction to Markov chains and Python (55 minutes)

  • Lecture: Markov processes and Markov chains; IDLE; Python under the covers
  • Hands-on exercise: Implement class
  • Q&A
  • Break (5 minutes)

Functions (55 minutes)

  • Lecture: Functions; dictionaries; looping; indexing; exceptions
  • Hands-on exercise: Implement function
  • Q&A
  • Break (5 minutes)

Code coverage and consistent tests (60 minutes)

  • Lecture: Truthiness; import this; throwing errors; tests and consistency; code coverage
  • Hands-on exercises: Fix predict method; implement code coverage and consistent tests
  • Q&A
  • Homework: Function for testing long sentences exercise

Day 2

Memory (50 minutes)

  • Lecture: Improving performance with memory; function and method parameters; slicing
  • Hands-on exercise: Add memory
  • Q&A
  • Break (5 minutes)

File reading (50 minutes)

  • Lecture: Files; strings; unicode; modules
  • Hands-on exercise: Add file reading
  • Q&A
  • Break (5 minutes)

REPL and the command line (60 minutes)

  • Lecture: REPL; command-line arguments
  • Hands-on exercises: Add REPL; add command-line arguments
  • Q&A

Wrap-up and Q&A (10 minutes)