python iterar diccionario 1

python iterar diccionario

# Iterar sobre claves
for clave in diccionario.keys():
# Iterar sobre valores
for valor in diccionario.values():
# Iterar sobre pares clave-valor
for clave, valor in diccionario.items():
    haz_algo_con(clave, valor)

Here is what the above code is Doing:
1. The first for loop iterates over the keys of the dictionary.
2. The second for loop iterates over the values of the dictionary.
3. The third for loop iterates over the key-value pairs of the dictionary.

Similar Posts