subject

At the end of most textbooks there is usually 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 the page number, you will use the line number. Implement the 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 the file only once.
>>> index('raven. txt', ['raven', 'mortal', 'dying', 'ghost', 'ghastly', 'evil', 'demon'])
raven 44, 53, 55, 64, 78, 97, 104, 111, 118, 120
mortal 30
dying 9
ghost 9
ghastly 82
evil 99,106
demon 122
>>>

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Ineed on my history if anyone can check out the last few questions i posted and i will be posting !
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
You know the right answer?
At the end of most textbooks there is usually an index that lists the pages where a certain word app...
Questions
Questions on the website: 13722361