Update grid.py

this is my final code