Dictionaries; for-loops ex39.py

Hi there!
This might be a piece of cake for others, but I’ll accept the humiliation for the sake of understanding. I would like to know the English translation of lines 38 & 43 in ex39.py script. Thanks.

image

Hello @PyBaseLearner_J

abbrev and city are variables.

list(cities.items()) gives the key and value in the dictionary.
(example: {”NY”: ”New York”} )

In the for loop abbrev = key and city = value.
So the print(f”{abbrev} has the city {city} will be:
”NY has the city New York”

I don´t think it´s humiliating to ask.
It’s brave.

Thanks @ulfen69. Your time and help are greatly appreciated.
Have a good one.

I’d write that out as english in kind of reverse:

“Python, take states.items(), turn it into a list, and then for each pair of state/abbrev do this:”

Interestingly, I have list there and that’s a typo. Not sure why I put that there.