O'Reilly logo
live online training icon Live Online training

Getting started with Python 3

Learn the basics by building a Markov chain generator

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.


  • A machine with Python 3.6 installed and the ability to run IDLE (Click to launch on Windows or run python3 -m idlelib.idle.)

Recommended preparation:

Head First Python (book)

Think Python (book)

Treading on Python: Volume 1 (book)

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

Break (10 minutes)

Functions (45 minutes)

  • Lecture: Functions; dictionaries; looping; indexing; exceptions
  • Hands-on exercise: Implement function

Break (10 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
  • Homework: Function for testing long sentence exercise

Day 2

Memory (45 minutes)

  • Lecture: Improving performance with memory; function and method parameters; slicing
  • Hands-on exercise: Add memory

Break (10 minutes)

File reading (45 minutes)

  • Lecture: Files; strings; unicode; modules
  • Hands-on exercise: Add file reading

Break (10 minutes)

REPL and the command line (60 minutes)

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

Wrap-up and Q&A (10 minutes)