Capital One interview question

Solve a matrix in Python