निम्नलिखित का आउटपुट क्या होगा?
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
[2 3 4 5]
B
[3 4 5 6]
C
[1 2 3 4]
D
[2 4 6 8]
Explanation
Sure!
a = [2, 3, 4, 5]b = [0, 1, 2, 3](fromnp.arange(4))
Adding a and b element-wise:
2 + 0 = 23 + 1 = 44 + 2 = 65 + 3 = 8
So, the result is [2 4 6 8].
Answer: (D) [2 4 6 8].
Correct Answer: D) [2 4 6 8]