Guidelines
for completing and submitting homework
Refer to the first two paragraphs on the Grading Info
page for all the details. Briefly,
you may not collaborate with your
classmates while writing homework
programs. However, you may certainly
consult Spencer on Thursday evenings or
Dr. V on Friday afternoons as you create
your programs. (Email your program
to me first to check that I'm in the
office.) Other QRC mentors may also
be able to help out, depending on their
experience with Python. Once you
have completed your program, or made as
much progress as possible, email your
program as an attachment to svandervelde@stlawu.edu.
Assignment
To begin, create a new document in Komodo
and include these comments at the top
# Your
full name
# Homework #5, Oct 19, 2012
# Individuals providing
assistance, if any
Then save your file using the format LastnameHW5.py.
Now write a program that performs the
three tasks described below. (It
will help to copy and paste lines of code
from the urllib.py
file available via our Schedule page.)
- Determine the percentage of words in
the word.txt
file that begin and end with the same
letter. In this and the subsequent
parts, be sure to first clean up each
line of the file with .strip
and .lower
commands.
- Print all words in the word.txt
file with three or more letters that
contain none of the vowels a, e, i, o,
u. (In other words, words like
"gym" or "tryst".)
- Choose your favorite common letter of
the alphabet. (So avoid letters
like j or q.) Then print out all
words from the word.txt
file in which your letter appears at
least four times.