|
| 1 | +# Problem Statement |
| 2 | +# Represent a small bilingual (English-Swedish) glossary given below as a Python dictionary |
| 3 | +# |
| 4 | +# {"merry":"god", "christmas":"jul", "and":"och", "happy":"gott", "new":"nytt", "year":"ar"} |
| 5 | +# |
| 6 | +# and use it to translate your Christmas wishes from English into Swedish. |
| 7 | +# |
| 8 | +# That is, write a python function translate() that accepts the bilingual dictionary and a list of English words (your Christmas wish) |
| 9 | +# and returns a list of equivalent Swedish words. |
| 10 | + |
| 11 | +#lex_auth_012693774187716608134 |
| 12 | + |
| 13 | +def translate(bilingual_dict,english_words_list): |
| 14 | + #Write your logic here |
| 15 | + swedish_words_list = list() |
| 16 | + for i in english_words_list: |
| 17 | + swedish_words_list.append(bilingual_dict[i]) |
| 18 | + |
| 19 | + return swedish_words_list |
| 20 | + |
| 21 | + |
| 22 | +bilingual_dict= {"merry":"god", "christmas":"jul", "and":"och", "happy":"gott", "new":"nytt", "year":"ar"} |
| 23 | +english_words_list=["merry","christmas"] |
| 24 | +print("The bilingual dict is:",bilingual_dict) |
| 25 | +print("The english words are:",english_words_list) |
| 26 | + |
| 27 | +swedish_words_list=translate(bilingual_dict, english_words_list) |
| 28 | +print("The equivalent swedish words are:",swedish_words_list) |
0 commit comments