Question: Python 3.6 Question 13 (20 points) Write a function named lineIndex that takes a file name, fName, as a parameter and returns a dictionary, d,
Python 3.6

Question 13 (20 points) Write a function named lineIndex that takes a file name, fName, as a parameter and returns a dictionary, d, that indexes the words in fName by line number, with the first line in fName being numbered 0 Each word in fName should be a key in the returned dictionary d, and the corresponding value should be a list of the line numbers on which the word occurs. A line number should occur no more than one time in a given list of line numbers. The file fName contains only upper and lower case letters and white space. Capital and lower case letters are different. That is, 'You' is not the same word as 'you'. For example, if the file named makeItRain.txt contains these ines I have no pride I have no shame You gotta make it rain Make it rain rain rain then the following would be correct output print(lineIndex( 'makeItRain.txt')) {'rain': [2, 3], 'gotta': [2], "make': [2], it': [2, 3], shame': [1], 'I': [0, 1], 'You': [2], have': [0, 1], 'no: 1, 'Make': [3], 'pride':[01) [0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
