Observe the following code and identify what will be the outcome (4)?

10. Observe the following code and identify what will be the outcome?

import numpy as np 

a = np.array([10, 20, 30, 40])
b = np.array([18, 15, 14])
c = np.array([25, 24, 26, 28, 23])

x, y, z = np.ix_(a, b, c)

print(x)
  1. [[[10]]
    
     [[20]]
    
     [[30]]
    
     [[40]]]
  2. [[[1]]
    
     [[2]]
    
     [[3]]
    
     [[4]]
    
     [[5]]] 
  3. [[[18]]
    
     [[15]]
    
     [[[14]]]
  4. None of the mentioned above

Answer: A)

[[[10]]

 [[20]]

 [[30]]

 [[40]]] 

Explanation:

To acquire the result for each n-uplet, the ix_ function can be used to mix different vectors together in one operation. In this case, if you wish to compute all of the a+b*c for all of the triplets derived from each of the vectors a, b, and c.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.