How can I return a list having the following sum v[i]=A[i,2i]+A[i,2i+1]

26 Views Asked by At

A is a matrix of size nx2n ,and I'm trying to write a Python code that will return the list v without using a for loop using numpy functions.

1

There are 1 best solutions below

5
On

li = [A[i][2*i] + A[i][2*i + 1] for i in range(n)]