In this python numpy program, we will find the set difference between two arrays using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create two arrays using np.array().
- Find the set difference between two arrays using np.setdiff1d().
- Print the output
import numpy as np
x = np.array([56,18,28,36])
y = np.array([76,36,56])
print(np.setdiff1d(x,y))
Output :
[18 28]