Question: use python to write and submit a script that asks for a filename (to which mbox.txt and mbox-short.txt will be used) and looks for lines

use python to write and submit a script that asks for a filename (to which mbox.txt and mbox-short.txt will be used) and looks for lines of the form

New Revision: 39772

Extract the number from each of the lines using a regular expression and the findall() method. Compute the average of the numbers, rounded to a single decimal place, and print out the average and the number of lines used for the computation.

Enter filename: mbox.txt

Average = 38549.8

Number of lines = 1790

Enter filename: mbox-short.txt

Average = 39756.9

Number of lines = 27

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!