difference() - Returns a set containing the difference between two or more sets

Returns a set containing the differences between two sets.  If you have two sets, a and b, a.difference(b) returns all the items in a that are not in b.

Example

Python
desktopComponents = {'memory', 'processor', 'hard drive'}
laptopComponents = {'memory', 'processor', 'SSD', 'camera', 'keyboard'}
notInDesktop = laptopComponents.difference(desktopComponents)
notInLaptop = desktopComponents.difference(laptopComponents)
print(f'Components only in the laptop computer: {notInDesktop}')
print(f'Components only in the desktop computer: {notInLaptop}')

Output

Components only in the laptop computer: {'keyboard', 'SSD', 'camera'}
Components only in the desktop computer: {'hard drive'}