Write a program for elements of anti diagonal
def anti_diagonal(matrix): return [matrix[i][-i-1] for i in range(0, len(matrix))] matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(anti_diagonal(matrix))
output:
[3, 5, 7]
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment