I am writing a function with the parameters d
and e
. d
represents a matrix that the user inputs, and e
represents the starting position in the matrix. I was able to define e
as the position of the matrix d
:
mainIndex = e[0]
secondIndex = e[1]
position = d[row][column]
I have a challenge whereby if the user inputs the position outside of the matrix the user inputted, it returns False
; for instance, if the matrix d = [[3,2,1],[6,5,4],[9,8,7]]
and e = [3,0]
, it should return False
rather than raising an index out of range
error. How do I achieve that?