Articles → NUMPY → Adding 2 Arrays Item By Item In Numpy
Adding 2 Arrays Item By Item In Numpy
Example
import numpy as np
arr = np.arange(1, 10)
print("Print Array before addition:", arr)
arr = arr + arr
print("Print Array after addition:", arr)
Click to Enlarge
import numpy as np
arr = np.arange(1, 10)
print("Print Array before subtraction:", arr)
arr = arr - arr
print("Print Array after subtraction:", arr)
Click to Enlarge
import numpy as np
arr = np.arange(1,10)
print("Print Array before multiplication:", arr)
arr = arr * arr
print("Print Array after multiplication:", arr)
Click to Enlarge
import numpy as np
arr = np.arange(1,10)
print("Print Array before division:", arr)
arr = arr / arr
print("Print Array after division:", arr)
Click to Enlarge