We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7634ad5 commit 5e02d9cCopy full SHA for 5e02d9c
Numpy/P08_NumpyArithmeticOperations.py
@@ -0,0 +1,25 @@
1
+# Author: OMKAR PATHAK
2
+
3
+import numpy as np
4
5
+firstArray = np.arange(12).reshape(3, 4)
6
+print(firstArray)
7
8
+secondArray = np.arange(4)
9
+print(secondArray)
10
11
+# adding above two arrays (NOTE: array shapes should be same)
12
+print(np.add(firstArray, secondArray))
13
14
+# subtracting above two arrays
15
+print(np.subtract(firstArray, secondArray))
16
17
+# multiplying above two arrays
18
+print(np.multiply(firstArray, secondArray))
19
20
+# dividing the above two arrays
21
+print(np.divide(firstArray, secondArray))
22
23
+# numpy.power(): returns array element raised to the specified value result
24
+array = np.array([1, 2, 3])
25
+print(np.power(array, 2)) # [1 4 9]
0 commit comments