Computers and Technology

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
>>>

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 23.06.2019 09:50, tatumleigh04
Allison and her group have completed the data entry for their spreadsheet project. they are in the process of formatting the data to make it easier to read and understand. the title is located in cell a5. the group has decided to merge cells a3: a7 to attempt to center the title over the data. after the merge, allison points out that it is not centered and looks bad. where would the title appear if allison unmerged the cells in an attempt to fix the title problem?
Answers: 2
image
Computers and Technology, 24.06.2019 03:00, SiegeHatake4534
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
image
Computers and Technology, 25.06.2019 16:00, Marliii363782
When entering new data into your table, which key should you press to move from one field or cell to the next?
Answers: 1
Do you know the correct answer?
At the end of most textbooks there is usually an index that lists the pages where a certain word app...

Questions in other subjects:

Konu
Mathematics, 07.09.2021 21:50
Konu
French, 07.09.2021 21:50
Konu
Computers and Technology, 07.09.2021 21:50
Konu
History, 07.09.2021 21:50
Konu
Mathematics, 07.09.2021 21:50