Assignment 16 — web access
Due Tuesday September 29
Problem reveal.py
- Gets two inputs
- Name of a web file from the class web folder http://www.cs.virginia.edu/cs1112/datasets/text/
- List of indices
- Outputs
- Prints on separate lines, those words in the web file indicated by the list of indices.
Requirement
- Only output what was requested.
Two program runs
Enter name of web file: macaronic.txt
Enter indices of interest: 8 3 2 6 4 1 0 9 5 7
macaronic
denotes
a
mixture
of
words
drawn
from
different
languages
Enter name of web file: scramble.txt
Enter indices of interest: 13 15 34 1 4 24 9 27 35 4 31 12 8 4
want
what
you
do
.
do
what
you
want
.
but
always
yabba-dabba-doo
.
Suggested algorithm
- Get a hold of the local module for web support.
- Define repository for text files of interest.
- Input name of web file.
- Define the link to the web file.
- Get the contents of the web file.
- Split text into a list of words
- Input indices of interest
- Split indices reply into a list of numeric strings
- Produce a list of numeric indices from the numeric strings
- Run through the indices and print the associated word from the list of words
© 2020 Jim Cohoon | Resources from previous semesters are available. |