Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Please write the follwoing Python 3 program. Also, please show all outputs. ________________________________________________________________________________ Beautiful Soup to be used for this program above (save as

1. Please write the follwoing Python 3 program. Also, please show all outputs.

image text in transcribed

________________________________________________________________________________

Beautiful Soup to be used for this program above (save as a txt file:

BEAUTIFUL Soup, so rich and green, Waiting in a hot tureen! Who for such dainties would not stoop? Soup of the evening, beautiful Soup! Soup of the evening, beautiful Soup!

Beau--ootiful Soo-oop! Beau--ootiful Soo-oop! Soo--oop of the e--e--evening, Beautiful, beautiful Soup!

Beautiful Soup! Who cares for fish, Game, or any other dish? Who would not give all else for two Pennyworth only of Beautiful Soup? Pennyworth only of beautiful Soup?

Beau--ootiful Soo-oop! Beau--ootiful Soo-oop! Soo--oop of the e--e--evening, Beautiful, beauti--FUL SOUP!

Program 1: file_stats. (10 pts) Write a program file stats.py that accepts a text file name as an argument and outputs the number of characters, words, lines, and the length (in characters) of the longest line in the file. Example python file stats.py beautiful soup by Lewis Carroll.txt Characters: 553 Words: 81 Lines: 21 Longest line: 38 The program should have a function stats that takes the filename as an input and returns the statistics as a tuple, so it can also be used this way: from file stats import stats >c, ,, stats ('beautiful soup by Lewis Carro.txt) print("c:, : l:0,l: .format(c, , U)) c: 553, : 81, : 21, : 38

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago