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
2 questions1
Which of the following is true about Add Set Items?
2
What is the most common pitfall when working with Add Set Items?
Answer all questions to submit.