This is a modified version of https://www.tensorflow.org/tutorials/quickstart/beginner that adds in some commments and matplotlib figures to explain what is happening better.
The code depends on tensorflow and matplotlib so the following code needs to run first:
pip install tensorflow
pip install matplotlib