Python code for solving the one-dimensional diffusion equation

The following Python code sets up and solves the diffusion equation for all three methods discussed.