Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created March 19, 2018 18:36
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 Fhernd/2e5ce0ecdc9050854e93914df9d94b44 to your computer and use it in GitHub Desktop.
Save Fhernd/2e5ce0ecdc9050854e93914df9d94b44 to your computer and use it in GitHub Desktop.
OrtizOL. Llaves y valores comunes en un diccionario. Python.
diccionario1 = {
'x': 1,
'y': 2,
'z': 3
}
diccionario2 = {
'w': -1,
'x': -2,
'y': 2
}
print('Llaves comúnes: ', diccionario1.keys() & diccionario2.keys())
print('Diferencia de llaves: ', diccionario1.keys() - diccionario2.keys())
print('Llave y valor comunes: ', diccionario1.items() & diccionario2.items())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment