Closed YakutovDmitriy closed 5 years ago
Hello!
Some issues I want to mension:
dict.tr
example I shared with you. It doesn't read line Russian: mem English: meme
correct because of whitespaces. If you wanted to change format you could change file dict.tr
.ja lybit ti
but not Ja lybit ti
python translate.py + russian megust english
it adds one word in russian. I expected to see an error message6.5 points
Dear Dmitry, Is there anything wrong with my translator?
Main requirements
Your program should never fail.
You are free to implement the task as you want. In particular, if there are some uncertainties, you have to decide what to do.
You are free to add some functionality. Please describe all features you added.
Implement application
translate.py
to translate words.You should store dictoinary in file dict.tr. Note that one string can have different meanings in different languages (e.g.
Ja
isYes
in German andI
in Russian). You can assume that one string can have no more than one meaning in one language.You should assume that name of language do not depend on case:
English
is the same language asenglish
.Add:
python translate.py + <Language-1> <Word-1> <Language-2> <Word-2> ...
Command should add list of words
<Word-1> ...
in languages<Language-1> ...
with the same meanings.Translate:
python translate.py ? <From language> <To language> <Phrase>
Command should translate phrase
<Phrase>
from language<From language>
to language<To language>
.<Phrase>
is list of several words separated by spaces:<Word-1> ... <Word-n>
. If one of the strings from phrase is not present in language<From language>
print a message about it. If one of the words have no translation to language<To language>
print a message about it. Otherwise you should print translated phrase to stdout.Do not forget to preserve the case! For example: