0

Trying to relearn python, working with Introducing Python by Bill Lubanovic. While learning about dictionaries, he uses this for loop to reverse the dictionary e2f to f2e:

e2f = {'dog': 'chien', 'cat': 'chat', 'walrus': 'morse'}
f2e = {}
for english, french in e2f.items():
    f2e[french] = english

I really don't understand these for loops, we never defined french or english, and I don't know how this process reverses the dictionary. If someone could explain this for loop it would be greatly appreciated!

martineau
  • 119,623
  • 25
  • 170
  • 301

0 Answers0