#### Exercise 207

Given a set **A = { ‘a’, ‘b’, ‘c’, ‘d’ }**. Write an algorithm in Python that adds an element **‘x’** to A __without using__ the **add()** method.

#### Solution

`A = { 'a', 'b', 'c', 'd' }`

# we add 'x' to A via the union() method

A2 = A.union({'x'})

# show set A2

print(A2) # output: {'a', 'd', 'b', 'c', 'x'}

**Younes Derfoufi**

my-courses.net

my-courses.net