Update grid.py

Here is my version of the code