bird's-eye view of asphalt road
Photo by Avi Waxman on Unsplash

If you need to find whether 2 sets have the same elements, then you need to use an operation such as intersection.

This operation is known in Math and used everywhere. In Python, we have 2 built-in methods that we can use right away to find whether 2 sets have the same elements or not.

Let us say that we have 2 sets like the following:

If we want to find their intersection, we can simply use the *intersection()* method like the following:

There is another method to find it which is by using the operator *&*:

That’s basically it.

I hope you find it useful.