The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
FOR PYTHON: Write a function translate() that provides a rudimentary translation service. The function takes a dictionary as a parameter. That dictionary maps words in one language to corresponding words in another language. The function allows users to type words in the first language and then prints translations of the words into the second language. If a word is entered that cannot be found in the dictionary, it should be translated using as many underscores as the length of the word entered. The user should be allowed to type as many words as he/she wishes for translation. When the user is done, he/she should type 'quit' to stop the program. Capitalization of the words typed by the user should matter when doing the translation but not when determining if the user wishes to quit. The following shows a sample run of the function. You cannot assume that the dictionaries provided in the example below will be used when grading your function:
Â

Show transcribed image text FOR PYTHON: Write a function translate() that provides a rudimentary translation service. The function takes a dictionary as a parameter. That dictionary maps words in one language to corresponding words in another language. The function allows users to type words in the first language and then prints translations of the words into the second language. If a word is entered that cannot be found in the dictionary, it should be translated using as many underscores as the length of the word entered. The user should be allowed to type as many words as he/she wishes for translation. When the user is done, he/she should type 'quit' to stop the program. Capitalization of the words typed by the user should matter when doing the translation but not when determining if the user wishes to quit. The following shows a sample run of the function. You cannot assume that the dictionaries provided in the example below will be used when grading your function:
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll