some of elements are arrays in python

The solution for “some of elements are arrays in python” can be found here. The following code will assist you in solving the problem.

l = len(matrix[0])
print([matrix[i][i] for i in range(l)]) # [-2, -6, 7, 8]
print([matrix[l-1-i][i] for i in range(l-1,-1,-1)]) # [ 2, 5, 2, -1]

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in