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 06:00
Pthe price of tickets in a group when a purchased in bulk can be found with the equation c=px+24 were c is the cost, p is the number of people,and x is the price per ticket. what is price of of each ticket if it costs $189 to buy tickets for 15 people ? a $8 b $24c $9d $11 show work
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
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, 11.10.2020 06:01
question
Computers and Technology, 11.10.2020 06:01
question
Mathematics, 11.10.2020 06:01
question
Biology, 11.10.2020 06:01
question
Mathematics, 11.10.2020 06:01
Questions on the website: 13722363