Update grid.py

This solution is more efficient in a large-scale program where it could be used more than once,
But just as a program in itself it's a little bit... unnecessary?