Python Practice › Set Programs › Program 35
Are two sets equal?
Write a Python program to check whether two sets are equal.
Input
{1, 2, 3}, {3, 2, 1}Output
True False
Approach
==compares contents; order does not matter.
Solution
print({1, 2, 3} == {3, 2, 1}, {1, 2} == {1, 2, 3})Output
True False
Learn the concept
New to this topic? Read the lesson, then come back.