Question: python please Consider the following dictionary which stores a list of word pairs for translating English words to French words: dictionary = {'house':'maison', 'apple':'pomme', 'tree':'arbre',

python please Consider the following dictionary which stores a list of wordpython please

Consider the following dictionary which stores a list of word pairs for translating English words to French words: dictionary = {'house':'maison', 'apple':'pomme', 'tree':'arbre', 'horse': 'cheval', "yellow':'jaune', 'keyboard':'clavier', 'water':'eau', 'start':'commencer', 'city':'ville', 'ear':'oreille', 'eel': 'anguille', 'tooth':'dent'} Write a function called get_french_word (word_dictionary, word) that takes such a dictionary and a word as parameters. The function should return the French word that corresponds to the parameter English word. If the English word does not appear in the dictionary, then your function should return an error message to indicate that the particular word is not available. If the word is an empty string, the function should return the error message "ERROR: Invalid word!". If the word is of an invalid type, the function should return the error message "ERROR: Invalid input!". Note: you *must* use the try... except syntax and handle the KeyError in your solution. You can assume that the dictionary is given. For example: Test Result print(get_french_word (dictionary, 'house')) maison print(get_french_word (dictionary, 'orange')) ERROR: orange is not available. print(get_french_word (dictionary, "')) ERROR: Invalid word! print(get_french_word (dictionary, .5)) ERROR Invalid input! Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!