What is the output of the following? x = {1, 2, 3} & {2, 3, 4} print(x)

Python Developer Medium

Python Developer — Medium

What is the output of the following? x = {1, 2, 3} & {2, 3, 4} print(x)

Key points

  • The '&' operator is used for set intersection.
  • Sets do not allow duplicate elements.
  • The resulting set contains only elements that are common between the two sets.

Ready to go further?

Related questions