Modifying Python Sets
Premium
Creating a set is only the beginning. This lesson covers how to grow and shrink sets after creation: .add() inserts elements, .discard() removes them safely, and .clear() wipes everything. You will also see why .discard() is often safer than .remove().