Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
26
11
78
10.8K
Siddartha DevOps
Siddartha DevOps@SiddarthaDevops·
A) [5,7,9]. np.array creates NumPy arrays Adding two elemnts-wise gives [1,2,3]+[4,5,6] = [1+4, 2+5, 3+6] = [5,7,9]. if you like the answer, please give Like, RT, Repost. we are spending time and giving answers.
English
1
1
9
702
Jenny
Jenny@JennyTheDev·
@PythonPr A) [5, 7, 9] NumPy does element-wise addition, not concatenation. 1+4=5, 2+5=7, 3+6=9 This is why we love NumPy 🐍
English
1
0
4
239
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: (A) In NumPy, when you add two arrays of the same size, the operation is performed element-wise. This means that each element in the first array is added to the corresponding element in the second array. The first elements are added: (1+4=5)
English
1
0
4
258
ANKIT 𓃱
ANKIT 𓃱@A9kitSingh·
@PythonPr A) [5, 7, 9] — NumPy adds arrays element-wise, not like lists.
English
0
0
2
318
Jay
Jay@learnaiwthme·
@PythonPr A) [5, 7, 9] NumPy adds arrays element-wise, so it computes [1+4, 2+5, 3+6].
English
0
0
1
161
Othieno Michael Edwards
Othieno Michael Edwards@EdwardsOthieno·
@PythonPr 1. In numpy, arithmetic operators perform element wise operations. 2. The corresponding elements in both 1D array objects aggregate each other and the result is a new array object [5, 7, 9] 3. Alternatively using a ufunc np.add(a, b) offers an alternative solution to the above
English
0
0
1
57
Sergei Kotov
Sergei Kotov@kotov_dev·
A) [5, 7, 9] NumPy does element-wise addition: › a = [1, 2, 3] › b = [4, 5, 6] › a + b adds matching positions: 1+4=5, 2+5=7, 3+6=9 › Result: [5, 7, 9] For beginners: NumPy arrays aren't the same as Python lists! Lists concatenate with +, arrays perform math operations.
English
0
0
0
176
Python Tech
Python Tech@PythonTech43716·
@PythonPr A) [5,7,9] is the right answer. Here a,b are array not list so we can perform addition opertaor. ARRAY are different from they can store only one type of data and array are faster and simpler than list.
English
0
0
0
5
Paylaş