Homework 2-5

In this homework, you are going to write the outline of a program that opens a file that the user specifies, reads text from that file, outputs the word count of that file, and outputs the sentence count of that file. This is part 1 of a 2 part assignment: in part 2 you'll fill in the skeleton code you write here.

This part of the assignment is just writing an outline; please do NOT proceed to fill in the code for this part!

Task 1: Program Overivew

Your program will read the text to analyze from a file. Assume the file name will be collected through an input statement in your main function. You should have an input function that takes in that name and reads the content of that file. (We'll cover reading from a file next class.)

Your skeleton code should include all the code to run a main function, which should look like the one in the lab. Under that function, write a description of the entire program in comments. This description should list key steps of the program. For each step, list the variables you're trying to find (with names and types) and the functions you need to compute them.

Task 2: Function Outlines

Outline each function you mentioned in your description using the the function outline template. Remember that each function should have a singular purpose; don't make one do too much. You should fill in three examples for each function you outline.

Task 3: Skeleton Code

Write a name, inputs, a docstring, and a potential output for each of the functions you outlined in task 2.

Write down function names in the format def function_name(input1, input2, etc):

The docstring of your file should be written in '''triple quotes''' starting the line after the function name. It should have a line naming and describing each input parameter, a line describing the output, and a line describing the purpose of the function.

Your potential output should be written under the definition of the function name as a return statement, where you return a default value of the output type. We'll accept anything of the right type, but in practice, it makes sense to return something that's as simple as possible. For example, if your program outputs strings, you'd want the return statement to be return "".

Even though this is just an outline, your code should still follow the style guide. Your skeleton code should be a Python file which will run without errors, but it does not have to produce any output at this time.

Task 4

At the top of your file, write comments that state the number of hours you worked, whether you went to TA hours, and any collaborators.

Once you're done, upload your outline and your skeleton code to your google drive and share it with cs0030handin@gmail.com by midnight, 3/10. Make sure your submission has your name in the filename: FirstLast_HW2-5.py. “FirstLast” should be replaced with your first and last name or we will take off points. Make sure every task has been completed.