Python Set | difference_update() The difference_update() method helps in an in-place way of differentiating the set.
The previously discussed set difference() helps to find out the difference between two sets and returns a new set with the difference value, but the difference_update() updates the existing caller set.
If A and B are two sets. The set difference() method will get the (A –
B) and will return a new set. The set difference_update() method
modifies the existing set. If (A – B) is performed, then A gets modified
into (A – B), and if (B – A) is performed, then B gets modfied into (B –
A).