Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Python - Add Set Items?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Order
Put the learning moves in the order that makes the concept easiest to apply.
To add items from another set into the current set, use the update() method.
To add one item to a set use the add() method.
Once a set is created, you cannot change its items, but you can add new items.
Add Items
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.
add()Add Sets
To add items from another set into the current set, use the update() method.
tropicalAdd 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.).
Example
thisset = {"apple", "banana", "cherry"}
mylist = ["kiwi", "orange"]
thisset.update(mylist)
print(thisset)