Python Practice › Set Programs › Program 29

Is a set a superset?

EasySet Programs · 29 of 48

Write a Python program to check whether a set is a superset of another.

Advertisement
Input
{1, 2, 3, 4}, {2, 3}
Output
True False

Approach

  1. >= or issuperset().

Solution

Python
print({1, 2, 3, 4} >= {2, 3}, {1, 2} >= {2, 3})
Output
True False
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More set programs

← All 48 Set Programs