I have this dictionary,
states = {
'CT': 'Connecticut',
'CA': 'California',
'NY': 'New York',
'NJ': 'New Jersey'
}
and code here..
state2 = {state: abbrev for abbrev, state in states.items()}
I'm trying to understand what and how this abbrev for abbrev
works. Also it's not clear to me what state:
is exactly. I get the second part (state in states.items()). The output of this gives
{'Connecticut': 'CT', 'California': 'CA', 'New York': 'NY', 'New Jersey': 'NJ'}
but I'm not sure how this is working.. Thank you in advance.