Exercise 6. Create a dictionary from a Text File: When a program incorporates a large dictionary, the dictionary is usually created from a file, such as a text file by using dict function to convert a list into a dictionary. Whenever a word in the original sentence is not a key in the dictionary, the get method places the word itself into the translated sentence. The file “Textese.txt” contains a word and its translation into textese. Write a program to create a dictionary with the file, ask the user to enter a simple sentence then translate it into textese. Define two function createDictionary (filename) and translate (sentence, dictionary). Then define a main function to test your functions
Exercise 6. Create a dictionary from a Text File: When a
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images