Set comparisons are used to validate whether one set fully exists within another

- issubset()
- issuperset()
- isdisjoint()

## Subset

set2.issubset(set1) Returns True if all elements of second set are in first set. Else, False

*Example – 1*

Code:

```
set_1 = {'a', 1, 3, 5}
set_2 = {'a', 1}
is_subset = set_2.issubset(set_1)
print(is_subset)
```

Output

True

*Example – 2*

Code

```
set_1 = {4, 6}
set_2 = {2, 6}
is_subset = set_2.issubset(set_1)
print(is_subset)
```

Output

False

## SuperSet

set1.issuperset(set2) Returns True if all elements of second set are in first set. Else, False

*Example – 1*

#### Code

```
set_1 = {'a', 1, 3, 5}
set_2 = {'a', 1}
is_superset = set_1.issuperset(set_2)
print(is_superset)
```

#### Output

True

*Example – 2*

#### Code

```
set_1 = {4, 6}
set_2 = {2, 6}
is_superset = set_1.issuperset(set_2)
print(is_superset)
```

#### Output

False

## Disjoint Sets

set1.isdisjoint(set2) Returns True when they have no common elements. Else, False

#### Code

```
set_a = {1, 2}
set_b = {3, 4}
is_disjoint = set_a.isdisjoint(set_b)
print(is_disjoint)
```

Output

True