Assignment 15 — web access
Due Monday September 30
Problem ccw.py
- Gets two inputs
- Name of a web file from the class web folder http://www.cs.virginia.edu/cs1112/datasets/text/
- Character of interest
- Produces three outputs
- Number of characters in the web file,
- Number of times the character of interest occurs in the web file, the
- Number of words in the web file.
Requirement
- Only output what was requested.
Three program runs
Enter name of web file: roman
Enter single character: v
14 1 7
Enter name of web file: macbeth
Enter single character: u
416 35 69
Enter name of web file: tom-sawyer
Enter single character: z
368697 151 71053
Suggested algorithm
- Get a hold of the local module for web support.
- Define repository for text files of interest.
- Input name of web file.
- Input character of interest.
- Define the link to the web file.
- Get the contents of the web file.
- Compute the number of characters in the web file.
- Compute the number of times the character of interest occurs in the web file.
- Compute the number of words in the web file.
- Print the results.
© 2019 Jim Cohoon | Resources from previous semesters are available. |