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 14:10
In a flashdisk wich icon can you use to open files in computer
Answers: 1
question
Computers and Technology, 22.06.2019 04:00
Chloe is building a kiosk-based excel application. she wants to make some modifications to the screen elements in order to keep users from being distracted by parts of the application that are irrelevant to her application. she turns to henry for guidance as she knows he built a similar solution earlier this year.chloe has decided to hide the worksheet gridlines and the vertical scroll bar. what does henry tell her to use to do this? a) screen elements dialog boxb) display options dialog boxc) customization dialog boxd) excel options dialog box
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
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
question
Chemistry, 30.08.2021 17:50
question
Business, 30.08.2021 17:50
question
English, 30.08.2021 17:50
question
Biology, 30.08.2021 17:50
question
Arts, 30.08.2021 17:50
question
Business, 30.08.2021 17:50