No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

Playgrounds: Elimina elementos duplicados usando conjuntos

5/44

Aportes 511

Preguntas 5

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}

new_set = countries.union(northAm,centralAm,southAm)

Escribe tu solución 👇

print(new_set)

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}
new_set = countries | northAm | centralAm | southAm
print(new_set)

Escribe tu solución 👇

new_set = countries.union(northAm, centralAm, southAm)

new_set.update(countries, northAm, centralAm, southAm)

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}

new_set = set()
conjuntos = [countries,northAm,centralAm,southAm]

for lista in conjuntos:
new_set = new_set.union(lista)

print(new_set)

Profe usted en un comentario dijo que no habia que usar union. Pero usando union da bien el resultado ya que con hacer una union ya por defecto de la propiedad de conjunto no quedaria ningun repetido en el conjunto ¿supongo que lo decis por un tema de que le toma mas tiempo procesarlo si hacemos uniones? osea en un caso de 1248912 valores por ejemplo ahi afectaria?

new_set = countries.union(northAm,centralAm,southAm)

Así fue mi solución 💚

countries = {"MX", "COL", "ARG", "USA"}
northAm = {"USA", "CANADA"}
centralAm = {"MX", "GT", "BZ"}
southAm = {"COL", "BZ", "ARG"}

new_set = set()
new_set = countries | northAm | centralAm | southAm

print(new_set)

Les dejo mi respuesta, lo hice sin mirar la respuesta de los demás y lo razone con los apuntes que me hice en replit
result= (countries | northAm | centralAm | southAm)
new_set = set(result)
print(new_set)

Bastante sencillo!

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}

new_set = set()

Escribe tu solución 👇

new_set = countries | northAm | centralAm | southAm
print(new_set)

```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() new_set.update(countries , northAm , centralAm , southAm) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set.update(countries , northAm , centralAm , southAm)
Mi solución es uniendo los conjuntos de la antigua manera: ```python new\_set = countries | northAm | centralAm | southAm ```
no me juzguen ![](https://static.platzi.com/media/user_upload/clase-5-reto-da2df08d-c24b-444d-8b01-58719a2677c7.jpg)

No me sale el enunciado de la práctica. 😦

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}

new_set = countries | northAm | centralAm | southAm

print(new_set)

countries = {“MX”, “COL”, “ARG”, “USA”}
northAm = {“USA”, “CANADA”}
centralAm = {“MX”, “GT”, “BZ”}
southAm = {“COL”, “BZ”, “ARG”}

new_set = (countries|northAm|centralAm|southAm)
print (new_set)

```js new_set = set (countries | northAm | centralAm | southAm) print(new_set) ```new\_set = set (countries | northAm | centralAm | southAm) print(new\_set)
```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() new_set = countries | northAm | centralAm | southAm # Escribe tu solución 👇 print(new_set) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()new\_set = countries | northAm | centralAm | southAm# Escribe tu solución 👇print(new\_set)
`new_set.update(countries, northAm, centralAm, southAm)`
new\_set = set({\*countries, \*northAm, \*centralAm, \*southAm})
![](https://static.platzi.com/media/user_upload/image-43074fba-d891-4962-979b-93dc43b7288a.jpg)
new\_set =(countries | northAm | centralAm | southAm) print(new\_set)
```python # Mi codigo pero antes algo que evite el spoler #. #. #. #. #. #. #. #. #. #. #. #. #. countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() # Escribe tu solución 👇 new_set.update(southAm) new_set.update(northAm) new_set.update(centralAm) new_set.update(southAm) print(new_set) ```
Solution ```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() # Escribe tu solución 👇 new_set=countries.union(northAm.union(centralAm.union(southAm))) print(new_set) ```
```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} # Escribe tu solución 👇 def unique_elements (element_a, element_b, element_c, element_d): return element_a.union(element_b, element_c, element_d) new_set = unique_elements(countries, northAm, centralAm, southAm) print(new_set) ```
¿Cómo se corre el código? mi solución es countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = countries.union(northAm,centralAm,southAm) print(new\_set)
new\_set= countries | northAm | centralAm |southAm print(new\_set)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()new\_set = countries.union(northAm, centralAm, southAm) print(new\_set)
new\_set = set(countries.union(northAm,centralAm,southAm))
les dejo las dos fomras que encontre ```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() #Escribe tu solución 👇 new_set.update(countries, northAm, centralAm,southAm) #print(new_set) new_set = countries|northAm|centralAm|southAm print(new_set) ```
Muestro la resolución del ejercicio: ![](https://static.platzi.com/media/user_upload/image-c04cfd0a-b09c-4b35-bc27-520b7756a5a4.jpg)
Estaba entendiendo mal el ejercicio, pensaba que me decía que creara un conjunto sin los elementos repetidos, entonces lo estaba haciendo con ^ asi solo quedaban los elementos no repetidos , hasta que vi que solo querían que usara el metodo .union o |
```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set(countries | northAm | centralAm | southAm) # Escribe tu solución 👇 print(new_set) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set(countries | northAm | centralAm | southAm)# Escribe tu solución 👇 print(new\_set)
countries = {"MX", "COL","ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()new\_set = countries | northAm | centralAm | southAmprint(new\_set)
```js ``` ```html listo ``` ![](https://static.platzi.com/media/user_upload/image-92e17cc8-4c8a-4d90-b4de-82df68a0ddec.jpg)
![](https://static.platzi.com/media/user_upload/image-101849b4-cf44-4fb5-b134-60ab57676bb0.jpg)Muchas maneras de hacerlo, ya sea con la función o el operador!
hay dos soluciones para este problema la primera es: ```py new\_set = countries.union(northAm, centralAm, southAm) ``` la segunda es: ```py new\_set = countries | northAm | centralAm | southAm ```
Al principio creí que estaban pidiendo la diferencia simétrica, perdí 1 vida, leí nuevamente y solo era unión. Lo hice con operadores, no con método ![](https://static.platzi.com/media/user_upload/image-e3243cc2-0a63-4983-86a8-e08754d66402.jpg)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = countries | northAm | centralAm |southAm print(new\_set)
countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇 new\_set = (countries | northAm | centralAm | southAm) print(new\_set)
Cuando entro a los playgrounds. El navegador se me cuelga por completo y tengoq que cerrar o esperar un buen tiempo. Podrian por favor arreglar eso? Uso Edge. No es mi memoria, ni mucho menos mi internet, lo acabo de verificar es el playground no se que cosas contiene que es super lento, demasiado
```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() # Escribe tu solución 👇 new_set= countries.union(northAm,centralAm,southAm) print(new_set) ```
el test me funciona con `# # Definir los cuatro conjuntos de paísescountries = {"MX", "COL", "ARG", "USA"}northAmerica = {"USA", "CANADA"}centralAmerica = {"MX", "GT", "BZ"}southAmerica = {"COL", "BZ", "ARG"}` `# Crear un nuevo conjunto vacío para almacenar los países únicosnew_set = set()` `# Agregar todos los países de los cuatro conjuntos al conjunto nuevonew_set = countries.union( northAmerica, centralAmerica, southAmerica)` `# Imprimir el conjunto único resultanteprint(new_set)` pero al momento de realizar la ejecucion me aparece : TypeError: 'set' object is not callable
```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set(countries | northAm | centralAm | southAm) # Escribe tu solución 👇 print(new_set) ```Yo le ingrese los parametros dados a la función que ya estaba.
countries={'MEXICO','COLOMBIA','ARGENTINA','ESTADOS UNIDOS'}northAm={'ESTADOS UNIDOS','CANADA'}centralAm={'MEXICO','GUATEMALA','BRASIL'}southAm={'COLOMBIA','BRASIL','ARGENTINA'} new\_set=countries | northAm | centralAm | southAmprint(new\_set)
En realidad, descubrí que hay dos formas de hacerlo según lo aprendido en clase: ambas arrojan lo mismo:
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set  = set\_c = countries.union(northAm, centralAm, southAm)# Escribe tu solución 👇 print(new\_set)
![](https://static.platzi.com/media/user_upload/image-87057261-2dd8-41a6-a2e7-535f8acbd702.jpg)![](https://static.platzi.com/media/user_upload/image-99dd7756-9308-4e7d-9ded-98c2d26a2fb4.jpg)
![](https://static.platzi.com/media/user_upload/image-96c7b575-e337-411b-a464-56418402321e.jpg)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set(countries | northAm | centralAm | southAm)# Escribe tu solución 👇 print(new\_set)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} newCountries = set()# Escribe tu solución 👇newCountries = countries | northAm | centralAm | southAm print(newCountries)
new\_set = set(countries | northAm | centralAm | southAm)
![](https://static.platzi.com/media/user_upload/image-286a84f4-c4bd-40f6-aa3a-afef252b13b5.jpg)
![](https://static.platzi.com/media/user_upload/imagen-90036dca-a539-44fb-af17-f20bbc67c71e.jpg)
## **Join Sets** There are several ways to join two or more sets in Python. The `union()` and `update()` methods joins all items from both sets. The `intersection()` method keeps ONLY the duplicates. The `difference()` method keeps the items from the first set that are not in the other set(s). The `symmetric_difference()` method keeps all items EXCEPT the duplicates.
Oh I like this way to practice, thanks Plazti for continue working on new features, I really appreciate that!
new\_set = (countries | northAm | centralAm | southAm)
```ts countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new_set = countries.union(northAm,centralAm,southAm)# Escribe tu solución 👇 print(new_set) ```
```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set(countries | northAm | centralAm | southAm) # Escribe tu solución 👇 print(new_set) ```
`new_set = set(countries | northAm | centralAm | southAm)`
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = countries.union(northAm,centralAm,southAm)# Escribe tu solución 👇 print(new\_set)
**Solucion:** ```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = (countries | northAm | centralAm | southAm) # Escribe tu solución 👇 print(new_set) ```
```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} print(countries | northAm | centralAm | southAm) ```
1. ```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} print(countries | northAm | centralAm | southAm) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} print(countries | northAm | centralAm | southAm)
![](https://static.platzi.com/media/user_upload/image-428cbd20-34cb-4287-bba8-78320edb3202.jpg)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = countries.union(northAm.union(centralAm.union(southAm)))print(new\_set)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇prueba = countries | northAm | centralAm | southAmnew\_set = set((prueba)) print(new\_set)

Creo que la pregunta del ejercicio a resilver es un poco capciosa. Habla de que algorítmo usar cuando en realidad gracias a las operaciones de conjuntos que tiene Python podemos resolver éste tipo de escenarios de una manera más fácil y eficiente usando en éste caso la operación de conjuntos llamada unión, también representada con un pipe |.

countries = {"MX", "COL", "ARG", "USA"}
northAm = {"USA", "CANADA"}
centralAm = {"MX", "GT", "BZ"}
southAm = {"COL", "BZ", "ARG"}

new_set = set(countries | northAm | centralAm | southAm)
# Escribe tu solución 👇

print(new_set)
# or
american_countries = countries.union(northAm, centralAm, southAm)
print(american_countries)
aquí les comparto una manera sencilla countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = countries | northAm | centralAm | southAm# Escribe tu solución 👇 print(new\_set)
Mi solución: countries = countries.union(northAm)countries = countries.union(centralAm)new\_set = countries.union(southAm)
new\_set = set (countries|northAm|centralAm|southAm) print = (new\_set)
3 posibles soluciones. Quedaría la duda de cuál es más eficaz y que consume menos recursos o si es indiferente. ```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() new_set = countries.union(northAm, centralAm, southAm) # new_set = countries | northAm | centralAm | southAm # new_set.update(countries, northAm, centralAm, southAm) print(new_set) ```
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = countries.union(northAm,centralAm,southAm)# Escribe tu solución 👇 print(new\_set) ```js countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = countries.union(northAm,centralAm,southAm) # Escribe tu solución 👇 print(new_set) ```
```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() new_set = new_set.union(countries, northAm, centralAm, southAm) print(new_set) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = new\_set.union(countries, northAm, centralAm, southAm)print(new\_set)
![](https://static.platzi.com/media/user_upload/Captura%20de%20Pantalla%202024-04-11%20a%20la%28s%29%2008.33.02-a8c13b56-343b-4e88-803f-ffc3d6305dd7.jpg)
![](</Users/emilianogarello/Desktop/Captura de Pantalla 2024-04-11 a la(s) 08.33.02.png>)
```python countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new_set = set() # Escribe tu solución 👇 new_set = countries.union(northAm,centralAm,southAm) print(new_set) ```countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = countries.union(northAm,centralAm,southAm)print(new\_set)
![](https://static.platzi.com/media/user_upload/image-cbc096de-80bd-4e53-a3a2-c2f1cf2239ae.jpg)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} \# mi solución 👇 new\_num=list(countries|northAm|centralAm|southAm) new\_set=set(new\_num) print(new\_set)
hola, aquí está mi solución: countries = {"MX", "COL", "ARG", "USA"} northAm = {"USA", "CANADA"} centralAm = {"MX", "GT", "BZ"} southAm = {"COL", "BZ", "ARG"} new\_set = (countries|northAm|centralAm|southAm) print(new\_set)
![](https://static.platzi.com/media/user_upload/image-bad4cf01-d851-4718-a5c4-f074d14d889c.jpg)
Yo lo hice con la funcion update, y al ser un set este me devolverá los valores unicos. `new_set.update(countries,northAm,centralAm,southAm)`
Trate de usar DOS Métodos para memorizarlos mejor, sin embargo, se puede solo con union. ![](https://static.platzi.com/media/user_upload/Sets%20py-4640f5f3-d71b-40e1-bd8a-5daed5d2c621.jpg)
new\_set = countries | northAm | centralAm | southAm
Les dejo mi solución: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ new\_set = set(countries | northAm | centralAm | southAm)
`new_set = set(countries | northAm | centralAm | southAm) ` `#Salida:{'ARG', 'CANADA', 'USA', 'GT', 'BZ', 'COL', 'MX'} `
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = countries.union(northAm, centralAm, southAm)print(new\_set)
new\_set = set (countries) | set(northAm) | set (centralAm) | set (southAm)print(new\_set)
\# Escribe tu solución 👇new\_set = set()# Unir todos los conjuntos utilizando el método union()new\_set = countries.union(northAm, centralAm, southAm)print(new\_set) pude solucionar lo siguente \# Escribe tu solución 👇 new\_set = countries.union(northAm and centralAm and southAm) print(new\_set) En Python, el operador `and` no es utilizado para combinar conjuntos de esta manera. En su lugar, necesitas usar el método `union()` para unir conjuntos.
intente con esto pero no resulto alguien sabe porque? \# Escribe tu solución 👇 new\_set = countries.union(northAm and centralAm and southAm)print(new\_set)
countries = {"MX", "COL", "ARG", "USA"}northAm = {"USA", "CANADA"}centralAm = {"MX", "GT", "BZ"}southAm = {"COL", "BZ", "ARG"} new\_set = set()# Escribe tu solución 👇new\_set = new\_set.union(countries)new\_set = new\_set.union(northAm)new\_set = new\_set.union(centralAm)new\_set = new\_set.union(southAm) print(new\_set) \#pude haber hecho el operador para que se vea mas limpio pero es lo primero que se me vino a la cabeza xdd
Así lo hice y paso :) print(northAm | centralAm | southAm)

reto

Según los ejemplos, piden la Unión. Pero el enunciado dice que se eliminen los elementos repetidos de los cuatro conjuntos, esto sería diferencia simétrica. La unión no elimina el elemento repetido, lo que hace es que aparezca por única vez en el nuevo conjunto.
Symmetric Difference, ya que piden que los elementos repetidos de los cuatro se eliminen, y se obtenga un nuevo set. ![](https://static.platzi.com/media/user_upload/Capture-0a30a95d-2877-42f8-b495-f42ca17cde37.jpg) Solo es casualidad en este caso que new\_set sea igual a la union, esto se da porque no hay un elemento que se repita en todos los sets.
Mi solución un poco más sencilla teniendo en cuenta que el tipo de datos automáticamente descarta los elementos repetidos ´´´´ \<new\_set = (countries|northAm|centralAm|southAm)> ´´´´
![](https://static.platzi.com/media/user_upload/image-4cd25303-f793-4526-b80a-0489abd590f4.jpg)
![](https://static.platzi.com/media/user_upload/image-3948d756-cf7f-40ad-bf06-5ccd2ba1cd8b.jpg)
undefined