Kodewick
Start learning →
Starter←→0 / 100

Pocket dictionary

#060StarterDictsStrings3 min

A small dictionary turns English words into Spanish. Write translate(word, words): return the translation if word is in words, or word itself if it is not.

Examples
translate("cat", {"cat": "gato", "dog": "perro"})→'gato'
translate("bus", {"cat": "gato", "dog": "perro"})→'bus'
main.py
def translate(word, words):
    # your code here: look it up with get, falling back to word
    result = ""
    return result
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.