CS110 Introduction to Computing
Fall 2006
Lab Assignment#4
Assignment:
Problem: Write a Python program to analyze a text file to determine the number of lines, words, and letters/characters contained in the file. For example, when the program is run to process the contents of Mark Twain's Huckleberry Finn, we get the following interaction:
Enter filename: HuckleberryFinn.txt
Characters: 566016
Words: 110296
Lines: 11326
In the above sample output, the entire text of Huckleberry Finn is stored in a file called, HuckleberryFinn.txt (this file was obtained from Project Gutenberg). Visit Project Gutenberg and download at least two other texts of your chosing. You will need to strip some extraneous text out of the downloaded files before processing (see the HuckleberyFinn file for example).
What you will need to do
Notes:
Add the following line to all your Python programs:
# File: <place name of your program file here> # Date: <date created> # Created by: <your name> # Assignment: <place assignment number here>