COS 100: Introduction to Programming
Fall 2019
HW Project 01: Counting lines
Due: 09/11 Wed 10pm
According to the grace of God which was given to me, as a wise master builder I have laid the foundation, and another builds on it. But let each one take heed how he builds on it.
1 Corinthians 3:10
This assignment is intended to get you started writing Python code by modifying an existing program to extend its capabilities.
Start by saving a copy of counter.py and playing around with it to make sure you understand what it does and why.
Next, modify the program like so:
- [2 points] In the comment at the top of the program, change the authorship statement to use your name instead of mine, and add a brief citation "Adapted from a program written by Jed Yang" or some such.
- [4 points] In addition to reporting the number of lines in the file, the program should report the number of blank lines (i.e., lines with no characters) and the number of lines whose length is less than 80 characters.
- [optional, 0 points] Also report the number of lines containing the string "tofu".
When you are finished, upload your source file (the modified counter.py
file) to Moodle.
After you have uploaded it, you should be able to see a link to your submitted file.
You should click on it to download the file and confirm it has been uploaded properly.
Please only submit your .py
file and nothing else.
Start early, have fun, and discuss questions on Moodle.