Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 11, 2019 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/65497187f51f238422315bad76535ee3 to your computer and use it in GitHub Desktop.
Save parzibyte/65497187f51f238422315bad76535ee3 to your computer and use it in GitHub Desktop.
animales_terrestres = set(["Tortuga", "Lobo", "Perro", "Cangrejo"])
print("Terrestres: ", animales_terrestres)
animales_acuaticos = set(["Tiburón", "Pulpo", "Tortuga", "Cangrejo"])
print("Acuáticos: ", animales_acuaticos)
animales_terrestres_y_acuaticos = animales_terrestres.intersection(
animales_acuaticos)
print("Intersección: ", animales_terrestres_y_acuaticos)
# También usando el operador &
animales_terrestres_y_acuaticos = animales_terrestres & animales_acuaticos
print("Intersección con &: ", animales_terrestres_y_acuaticos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment