Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions