Python IF statment with Boolean list input

Check this:
Capture
This Python course here should help you grasp basics of Python:
https://www.codecademy.com/learn/learn-python
I really suggest just starting with the free version.

What do you want to do with those grids exactly?