Python Practice › Set Programs › Program 10
Is one set a subset of another?
Write a Python program to check whether one set is a subset of another.
Input
{2, 3}, {1, 2, 3, 4}Output
True True False
Approach
<=orissubset();<checks a proper subset.
Solution
small, big = {2, 3}, {1, 2, 3, 4}print(small <= big, small < big, big <= small)Output
True True False
Learn the concept
New to this topic? Read the lesson, then come back.