Represent a small bilingual lexicon as a Python dictionary in the following fashion
d = {"merry":"frohe", "christmas":"weihnachten", "and":"und", "happy":"frohes", "new":"neues", "year":"jahr"}
and use it to translate your Christmas cards from English into German. That is, write a functiontranslate() that takes a list of English words and returns a list of German words.
d = {"merry":"frohe", "christmas":"weihnachten", "and":"und", "happy":"frohes", "new":"neues", "year":"jahr"} def translate(list_in_english): list_in_german = [] for word in list_in_english: list_in_german.append(d[word.lower()]) return list_in_german def main(): eng_list_1 = ["Merry", "Christmas"] eng_list_2 = ["Merry", "Christmas", "And", "Happy", "New", "Year"] ger_list_1 = translate(eng_list_1) ger_list_2 = translate(eng_list_2) print(ger_list_1) print(ger_list_2) if __name__ == '__main__': main()