-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathproblem_20.py
More file actions
23 lines (20 loc) · 753 Bytes
/
problem_20.py
File metadata and controls
23 lines (20 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
Represent a small bilingual lexicon as a Python dictionary
in the following fashion {"merry":"god", "christmas":"jul",
"and":"och", "happy":gott", "new":"nytt", "year":"år"}
and use it to translate your Christmas cards from
English into Swedish. That is, write a function
translate()that takes a list of
English words and returns a list of Swedish words
'''
dic = {"merry":"god", "christmas":"jul",\
"and":"och", "happy":"gott", "new":"nytt", "year":"år"}
def translate(list_eng):
dic = {"merry":"god", "christmas":"jul",\
"and":"och", "happy":"gott", "new":"nytt", "year":"år"}
list_dic = []
for i in list_eng:
list_dic.append(dic[i])
return list_dic
ab = ["merry","happy"]
print(translate(ab))