The difference between the two sets in Python is equal to the difference between the number of elements in two sets. It returns set which contains items that exist only in the first set, and not in both sets.

## Syntax:

`set.difference(set)`

#### Parameters:

The set is required to check difference between sets.

#### Returns:

It returns the difference between two sets which is also a set.

## Examples:

```
A = {10,20,30,40}
B = {30,40,50,60}
C = A.difference(B)
print(C)
```

**Output:** {10, 20}

- Log in to post comments