Implement function translate() that provides a rudimentary translation service. The function input is a dictionary mapping words in one language (the first language) to corresponding words in another (the second language). The function provides a service that lets users type a phrase in the first language interactively and then obtain a translation into the second language, by pressing the Enter/Return key. Words not in the dictionary should be translated as __

Respuesta :

Answer:

Check the explanation

Explanation:

#method to find the word in one language and return

#corresponding word in other language

def translate(ltolDict):

#loop to display contents of the dictionary

   print("Welcome to the WordsRUs translation service.")

   word = input("Please enter a word: ")

   while word != "Quit" and word != "quit":

       if word in ltolDict:

           print(word ," means ", ltolDict[word])

       else:

           print(word ," means ", "________")

       word = input("Please enter a word: ")

   print("Thanks for using our translation service.")

A code screenshot can be seen below.

Ver imagen temmydbrain