This was written for my blog post Machine Learning for Beginners: An Introduction to Neural Networks.
Install numpy, the only dependency, if you need to:
$ pip install numpy
Then, run it with no arguments:
$ python network.py
You can also run this code in your browser.
You may also be interested in a Convolutional Neural Network (CNN) implemented from scratch in Python, which was written for my introduction to CNNs.