October 13, 2016 · Python

Quick reference to Python in a single script (and notebook)

Below is the reference guide to Python that I wish had existed when I was learning the language.

Here's what I want in a reference guide:

This is not written as a full-fledged Python tutorial, though I ordered the topics such that you can read it like a tutorial (i.e., each topic depends only on material preceding it).

The guide was written using Python 2 but is fully compatible with Python 3. Relevant differences between Python 2 and 3 are noted throughout the guide.

View/Download the Reference Guide

You can view it as a Python script on GitHub.

You can view it as a Jupyter notebook on nbviewer.

If you want to save a copy of either the script or the notebook, just clone or download the GitHub repository.

Table of Contents

Click to jump to the relevant section of the script or the notebook:

  1. Imports (script, notebook)
  2. Data Types (script, notebook)
  3. Math (script, notebook)
  4. Comparisons and Boolean Operations (script, notebook)
  5. Conditional Statements (script, notebook)
  6. Lists (script, notebook)
  7. Tuples (script, notebook)
  8. Strings (script, notebook)
  9. Dictionaries (script, notebook)
  10. Sets (script, notebook)
  11. Defining Functions (script, notebook)
  12. Anonymous (Lambda) Functions (script, notebook)
  13. For Loops and While Loops (script, notebook)
  14. Comprehensions (script, notebook)
  15. Map and Filter (script, notebook)

Other Python Resources

If you are looking for a resource that will help you to learn Python from scratch, check out my course, Python Essentials for Data Scientists.

Comments powered by Disqus