Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to add an item from another set or other data structures (lists, dictionaries, and tuples) to a set by using the update() method.

nameSet = {"John", "Jane", "Doe"}

nameSet2 = {"Jade", "Jay"}

nameSet.update(nameSet2)

print(nameSet)
# {'Doe', 'Jay', 'Jane', 'Jade', 'John'}
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #How #add #item #set #data #structures #set
ADD COMMENT
Topic
Name
8+9 =