subject
Computers and Technology, 08.01.2020 07:31 bm42400

Write a program to look for lines of the form: new revision: 39772and extract the number from each of the lines using a regular expression and the findall() method. compute the average of the numbers and print out the average. there are two data files. you must ask the user for the name of the file he wishes to process. you may assume that he will always enter either mbox. txt or mbox-short. txt. that is, you don't have to do any error trapping (no try/catch).your program should look for lines that begin with the text "new revision: " followed by any number of spaces, followed by any number of digits. extract the digits (they will be extracted as a string and will be inserted into a list that has the string as the only element, e. g. ["12345"]).convert each number into an integer (they will all be integers, no floating point numbers). count the number of such lines that you encounter and sum the numbers. at the end, print out the sum, the count, and the average (sum/count). below is the output for each file. you should get the same results. enter file: mbox. txtsum: 69004133count: 1790average: 38549.79497206704enter file: mbox-short. txtsum: 1073437count: 27average: 39756.92592592593

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 2
You know the right answer?
Write a program to look for lines of the form: new revision: 39772and extract the number from each...
Questions
question
Mathematics, 09.07.2019 00:30
question
Mathematics, 09.07.2019 00:30
question
Advanced Placement (AP), 09.07.2019 00:30
Questions on the website: 13722361