a = {'a','b','c'} b = {'d','e','f'}
I want to add above two given values.
A conclusion is required, for example,
c = {'a','b','c','d','e','f'}
This is not a dict , this is set . All you have to do to combine them is c = a|b .
dict
set
c = a|b
Settings are unordered sequences of unique values. a|b is the union two sets (a new set with all the values โโfound in any set). This is a class of operations called a โset operationโ that sets up handy tools for.
a|b
union
You can use update () to combine set (b) into set (a) Try this.
a = {'a', 'b', 'c'} b = {'d', 'e', 'f'} a.update(b) print a
and second solution:
c = a.copy() c.update(b) print c