Question: Needed in Python 3. No advanced code please. 6.27 At the end of this and other textbooks, there usually is an index that lists the

Needed in Python 3. No advanced code please.

Needed in Python 3. No advanced code please. 6.27 At the end

6.27 At the end of this and other textbooks, there usually is an index that lists the pages where a certain word appears. In this problem, you will create an index for a text but, instead of page number, you will use the line numbers You will implement function index () that takes as input the name of a text file and a list of words. For every word in the list, your function will find the lines in the text file where the word occurs and print the corresponding line numbers (where the numbering starts at 1). You should open and read the file only once. >>index('raven.txt', ['raven', 'mortal', 'dying 'ghost' File: raven.txt ghastly', 'evil', 'demon']) ghost 9 dying9 demon 122 99, 106 ghastly 82 mortal 30 raven 44, 53, 55, 64, 78, 97, 104, 111, 118, 120

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!