Back to Python Notes
Topic #55

Add Set Items

add and update insert items into a set, silently ignoring duplicates. This guarantee of uniqueness is why sets excel at deduplication.


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.

Example

  thisset = {"apple", "banana", "cherry"}

  thisset.add("orange")

print(thisset)

Add Sets

To add items from another set into the current set, use the update() method.

Example

  thisset = {"apple", "banana", "cherry"}
tropical = {"pineapple", "mango", "papaya"}

  thisset.update(tropical)

print(thisset)

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.).

Example

  thisset = {"apple", "banana", "cherry"}
  mylist = ["kiwi", "orange"]

  thisset.update(mylist)

print(thisset)

Want to go beyond the notes?

Join Coding Now Tech Institute's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Add Set Items – FAQs

Quick answers about learning Add Set Items in Python.

This free note from Coding Now Tech Institute explains Add Set Items in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on Coding Now Tech Institute, including Add Set Items, is 100% free with no signup required.
With focused practice, most students grasp Add Set Items in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now