DEV Community

I'm Just a Guy with a Computer
I'm Just a Guy with a Computer

Posted on

Comparing Sets in Python

Comparing Set - is the ability to check if a given subset or superset of another set.
The result is True or False depending on the elements present in sets.

Enter the below code to experience it pratically.
DaysA  = set(["Mon","Tue","Wed"])
DaysB  = set(["Mon","Tue","Wed","Thu","Fri","Sat","Sun"])


SubsetRes  = DaysA <= DaysB
SupersetRes  = DaysB >= DaysA

print(SubsetRes)
print(SubsetRes )
Enter fullscreen mode Exit fullscreen mode

output
When the above code is executed here below is the result

True
True

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more