In Python 3 3 While Searching A 2d List How Would I Determine The Next Location Is V 3432873

In python 3.3, while searching a 2D list, how would I determine the next location is valid or not? I know that you can use 8 if/elif statements to set the bounds, however my professor said to not use this. I am searching the list vertically, horizontally, and diagonally.