برای افزودن یک مورد به مجموعه از add() استفاده کنید
روش.
برای افزودن بیش از یک مورد به یک مجموعه از update() استفاده کنید
روش.
مثال
Add an item to a set, using the add()
method:
thisset = {"apple", "banana", "cherry"}
thisset.add("orange")
print(thisset)
مثال
Add multiple items to a set, using the update()
method:
thisset = {"apple", "banana", "cherry"}
thisset.update(["orange",
"mango", "grapes"])
print(thisset)