Answer to Question #311820 in Python for xxx

Question #311820

Question 8

Y = np.array([

 [3,6,9,12], 

 [15,18,21,24], 

 [27,30,33,36], 

 [39,42,45,48],

 [51,54,57,60]])

Answer: 


Question 8 Output

array([[ 3, 12],

    [27, 36],

    [51, 60]])

1
Expert's answer
2022-03-15T12:12:21-0400
import numpy as np
j = 0
list1 = []
Y = np.array([



 [3,6,9,12], 



 [15,18,21,24], 



 [27,30,33,36], 



 [39,42,45,48],



 [51,54,57,60]])
for i in Y:
    if j % 2 == 0:
        list1.append([i[0], i[-1]])
    else:
        pass
    j = j + 1
print(np.array(list1))

[[ 3 12]
 [27 36]
 [51 60]]

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