Dictionaries · 12 / 15 Exercise Medium

Reverse translator

Objective

Create a Python program that inverts a dictionary of translations so you can look up in the other direction.

Instructions

  • Use this Spanish → English dictionary: {"hola": "hello", "adios": "goodbye", "gato": "cat", "perro": "dog", "casa": "house"}.
  • Build a second English → Spanish dictionary by swapping keys and values.
  • Read a word in English.
  • Show its Spanish translation, or Not found if it is not in the dictionary.
Input
cat
Output
gato

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise