Question: Complete the below function that takes file name as an input and reads the text from the corresponding file, then creates a dictionary where the

Complete the below function that takes file name as an input and reads the text from the corresponding file, then creates a dictionary where the keys are the characters of the text, and the values are the counts of the characters. The function returns the created dictionary as a result. If the file does not exist, then the function returns an empty dictionary. Note that you SHOULDN'T count the new line character as part of the text. def text2dict(filename): return # Remove this line only when you answer this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
