A Better Way to Learn Python

The de facto roadmap for learning Python. This tutorial series will teach you Python's fundamental concepts paired with real-world examples and descriptions.

Derek Howard Up to date (May '19) Python


Coming from a C# .Net background, I didn’t invest much time into Python. Admittedly, I barely knew what it was. My first day as a Product Manager for an AI product to analyze customer service chat inputs and group them into buckets, I learned that it was written in Python and implemented the Django framework and Python NLU libraries.

Having just stepped out of the Microsoft software engineering world into Product Management and needing to connect to the software engineers that were developing the product, I installed Python and created my first virtual environment. I had a strong desire to understand their architectural hurdles and contribute in the product solution conversations. With a little help from my new teammates and a little time online at various different resources, I had my first Python + Django web application running. I made short work of the .Net core MVC demo app I was building. I was pleasantly surprised how easy it came together and admittedly frustrated how much easier it was than my .Net Core MVC startup project.

Unfortunately, most of the examples and tutorials I followed expected that I knew quite a bit about Python. They failed to link to the docs and other relevant resources leaving gaps in my understanding of what the code did I was blindly putting in place. This is the motivation behind this course. We are going to pull together the resources and ideas to make sure you have a foundational understanding of Python.

What is Python?

Python is a dynamic, interpreted language. There are no type declarations of variables, parameters, functions or methods in souce code. This makes the code readable and flexible and type checks happen at run time. The enterpreter can be used interactively to make it easier to experiment with features of the language.

Python allows you to split your program into modules that can be reused in other Python programs. It also includes a large collection of modules that you can use to build your application.


In this course we are assuming you have some general programming experience and are familiar with variables, types, collections, loops, etc. In this tutorial, I want to cover some of the things that make Python different. Like me, you may be coming from years of experience in another language and platform and want to see what this Python stuff is all about.

You have a couple options for getting started. You can use an online Python interpreter or you can install it locally. Lets tackle the first option: Online Python interpreters.

Check out repl.it

Nothing to install locally. Everything you need to work online in a contained environment with the ability to load packages and collaborate with other developers. You can also connect your repl.it to your github account and store a gist.

Check out CourceLair

"Frictionless development in your browser". Work on your Python projects instantly, on any device or computer without needing to install or configure anything.

Installing Python

Python programming is platform independent. The code you write should run on all supported platforms. We will cover the 3 major platforms: Mac OS X, Windows and Linux. If you already have it installed or you prefer to use an online interpreter, you can skip this section.

Install Python

Install Python on Mac OS X

The 2.7 version of Python that comes with Mac OS S is great for learning, but not ideal for development. You'll want the latest release from the official site. Instead of downloading the installer package from Python.org, I used a package manager to manage the installation for me (see below).

There are a couple of things you'll want to do before installing Python. You will need to install GCC. You can get GCC by installing Xcode, Command Line tools, or OSX-GCC-Installer.

Don't install OSX-GCC if you already have Xcode installed. Once you install Xcode, open the terminal and run xcode-select --install

I found it easiest to get Python on my Mac system by installing the package manager Homebrew.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing Homebrew, you'll need to make the following change to the bottom of your ~/.profile file. (OS X 10.13+)

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Check out this article if you have questions about your bash_profile.

Now you can install Python 3, which will also include Pip

$ brew install python

Now you can test that you have things set up. You should have the system Python 2.7 available and Python 3 as well

$ python --version
Python 3.7.2
$ python3 --version
Python 3.7.2
$ python2.7 --version
Python 2.7.10

Install Python on Windows

Download the latest version of Python from Python.org. I chose the web-based installer.

Launch the installer, selecting the option Add Python 3.7 to PATH, so you won't need to type the full path when calling Python commands. At the end of the install, before clicking 'Close', choose the option to 'Disable path length limit' from Windows.

The standard Python installation for Windows includes: A basic IDE, IDLE, The Python runtime, Python 3.7 Manuals, and Python 3.7 Module Docs

Now you can test that you have things set up. Click on the new Python 3.x interactive shell or open up a command prompt:

Python 3.7.2 (...

Install Python on Linux

Python comes preinstalled on most Linux distributions or is available as a package. The Python.org documentation has steps for the different options.

Start by checking which version of Python 3 you have installed. Open a command prompt and run

$ python3 --version

If you are using Ubuntu 16.10 or newer, then use the following commands

$ sudo apt-get update
$ sudo apt-get install python 3.7

Or use whatever your distribution's package manager is to install it.

Virtual Environments

Each of our projects are going to have dependencies that are mostly likely going to be different between the projects. They may even need a different version of Python. A Virtual Environment will allow us to keep our global packages directory clean. We can then freeze our project and create a requirements.txt file to make setting up our project much easier and specify the versions of the packages and modules we installed.

Get up to speed on the Python Documentation for Virtual Environments and packages