निम्नलिखित का आउटपुट क्या होगा?
What will be the output of the following ?
import numpy as np
a = np.array( [2, 3, 4, 5] )
b = np.arange(4)
print(a+b)
A)
B)
C)
D)
Explanation:
Sure!
a = [2, 3, 4, 5]
b = [0, 1, 2, 3]
(fromnp.arange(4)
)
Adding a
and b
element-wise:
2 + 0 = 2
3 + 1 = 4
4 + 2 = 6
5 + 3 = 8
So, the result is [2 4 6 8].
Answer: (D) [2 4 6 8].