fix syntax error in writing grains code snippet

A small fix in the python code snippet. For me that isn't deeply familiar with Python it was a pitfall.