Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def matrixDiagonal(matrix,x,y):
- #@param:
- # matrix: matrix;
- # k: int;
- assert matCheck(matrix), "Matrix is not square."
- assert x<len(matrix) and y<len(matrix) and x>=0 and y>=0
- i = 0
- while i<len(matrix)-x and i<len(matrix)-y:
- matrix[x+i][y+i] = 0
- i += 1
- def matCheck(matrix):
- #@param:
- # matrix: matrix;
- # return: bool;
- lenght = len(matrix)
- for i in range(0,lenght):
- if len(matrix[i]) != lenght:
- return False
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement