Python Tutorials · Python Sets
Add Set Items
Learn all about Add Set Items in this comprehensive tutorial.
5 min read beginner
- •To add one item to a set use the add() method.
- •To add items from another set into the current set, use the update() method.
- •The object in the update() method does not have to be a set, it can be any iterable object (tuples, lists, dictionaries etc.
Add Items
Note: Once a set is created, you cannot change its items, but you can add new items.
To add one item to a set use the add() method.
python
Add Sets
To add items from another set into the current set, use the update() method.
python
Add Any Iterable
The object in the update() method does not have to be a set, it can be any iterable object (tuples, lists, dictionaries etc.).
python
Module quiz
Test your knowledge on this module
2 questions