Created
March 19, 2018 18:36
-
-
Save Fhernd/2e5ce0ecdc9050854e93914df9d94b44 to your computer and use it in GitHub Desktop.
OrtizOL. Llaves y valores comunes en un diccionario. Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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