Answer to Question #218178 in Python for Krish

Question #218178

Write a program for elements of anti diagonal


1
Expert's answer
2021-07-19T00:35:14-0400
 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?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS