-1
I have the following matrix, for example:
matriz = [[1, 2, 3, 4, 5, 6],
[7, 8, 9, 3, 8, 9],
[4, 5, 2, 3, 4, 4],
[2, 3, 4, 5, 3, 6],
[4, 5, 3, 4, 5, 6]]
I would like to obtain only the elements of the main diagonal, such as:
A = [1, 8, 2, 5, 5]
Your question made no sense. Please read the [Ask] guide and rephrase it. If you’re new to the community, I recommend doing the [tour] as well.
– Woss
Put an example of what you want to make clear, so you can’t understand
– Anderson Henrique
I tried to clarify the example
– Alexandre Candido Teixeira
And how is your matrix defined in Python? Ask this in the question too.
– Woss
But this in the question
– Alexandre Candido Teixeira
@Alexandrecandidoteixeira is not. In the question there is a representation of the matrix, but it is not as you are defining it in Python. This may completely change the answer and so I will vote to close as unclear until there is such a correction.
– Woss
It only makes sense to speak in main diagonal with square matrices, and its example is a 6x5 matrix.
– Victor Stafusa