一本小词典把英语词翻成西班牙语。写 translate(word, words):words 里有这个词就返回它的翻译,没有就原样返回 word。
translate("cat", {"cat": "gato", "dog": "perro"})→'gato'translate("bus", {"cat": "gato", "dog": "perro"})→'bus'def translate(word, words):
# 在这里写:用 get 查,查不到就用 word 本身
result = ""
return result
写好了先点「运行」试试示例,没问题再点「提交」。