Q:

Write a NumPy program to compute xy, element-wise where x, y are two given arrays

0

Write a NumPy program to compute xy, element-wise where x, y are two given arrays.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.array([[1, 2], [3, 4]])
y = np.array([[1, 2], [1, 2]])
print("Array1: ")
print(x)
print("Array1: ")
print(y)
print("Result- x^y:")
r1 = np.power(x, y)
print(r1)

Sample Output:

Array1: 
[[1 2]
 [3 4]]
Array1: 
[[1 2]
 [1 2]]
Result- x^y:
[[ 1  4]
 [ 3 16]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now