Question
Create a program using Python that provides a simple, personal translation dictionary. Provide a text-driven menu that permits: translating a word adding a word to
Create a program using Python that provides a simple, personal translation dictionary. Provide a text-driven menu that permits:
translating a word
adding a word to the dictionary
printing the current dictionary
exiting
Use functions where appropriate, do not forget docstrings. Ensure your menu system handles input errors. You can structure your dictionary how you like, but it may be best to have a dictionary of dictionaries where the keys at the top level are English words and the values are dictionaries with keys being the foreign language and values being the translation. For example:
langDict = {"hello":{"Spanish":"hola","French":"bonjour"}, "good-bye":{"Spanish":"adios"}}
IMPORTANT!!!! - Make sure to read your dictionary in from a file upon program start-up and write your dictionary out to the same file at program termination.
Possible Outcome Example:
Main Menu 1-translate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: Invalidinput Main Menu 1-translate a word 2-add word to dict -print current cranslation dictionary -exit Please make a selection: joe Invalid Input- integer only Main Menu -teanslate a word 2-add word to dict -print current cranslation dictionary -exit Please make a selection: Provide an English word: SoEEy no translation for that word Main Nenu -translate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: Provide an English word: hello -'Spanish hola''French'bonjour Main Menu 1-translate a word -add word to dict 3-print current teanslation dictionary -exit Please make a selection:2 What Eng word are you providing a translation for: What language is the translated word in: Spanish What is the translated word:i Main Nenu -teanslate a word add word to dict -print current translation dictionary -exit Please make a selection: What Eng word are you providing a translation fors yes The word already exists yes- 'Spanish' What language is the translated word in: French What is the translated word: ou Main Nenu -teanslate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: hello Spanish' hola' French' bonjour good-bye-Spanish': adios es-Spanish' French' ou' Main Menu 1-translate a word -add word to diet -print current translation dictionary -exit Please make a selection: Goodbye Main Menu 1-translate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: Invalidinput Main Menu 1-translate a word 2-add word to dict -print current cranslation dictionary -exit Please make a selection: joe Invalid Input- integer only Main Menu -teanslate a word 2-add word to dict -print current cranslation dictionary -exit Please make a selection: Provide an English word: SoEEy no translation for that word Main Nenu -translate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: Provide an English word: hello -'Spanish hola''French'bonjour Main Menu 1-translate a word -add word to dict 3-print current teanslation dictionary -exit Please make a selection:2 What Eng word are you providing a translation for: What language is the translated word in: Spanish What is the translated word:i Main Nenu -teanslate a word add word to dict -print current translation dictionary -exit Please make a selection: What Eng word are you providing a translation fors yes The word already exists yes- 'Spanish' What language is the translated word in: French What is the translated word: ou Main Nenu -teanslate a word 2-add word to dict -print current translation dictionary -exit Please make a selection: hello Spanish' hola' French' bonjour good-bye-Spanish': adios es-Spanish' French' ou' Main Menu 1-translate a word -add word to diet -print current translation dictionary -exit Please make a selection: GoodbyeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started