COS 100: Introduction to Programming
Interim 2022
HW Project 01: Counting lines
Due: 01/05 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
Project goal
This assignment is intended to get you started writing Python code by modifying an existing program to extend its capabilities.
Project specification
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 short lines (i.e., lines whose length is less than 3 characters) and the number of blank lines.
- [optional, 0 points] Also report the number of lines containing the string "tofu".
(From time to time, optional challenges will be mentioned. These are worth no points, often go far beyond what you have learned by that time, and you are absolutely not required to attempt them.)
When you are done
-
Upload your source file (the modified
counter.py
file) to Moodle. -
It would help the grader if you keep the program named exactly
counter.py
, notCounter.py
,hw01-counter.py
, or anything else. - After you have uploaded it, you should be able to see a link to your submitted file.
- Click on it to download the file and confirm that it has been uploaded properly.
-
Please only submit your
.py
file and nothing else. - Please follow these instructions for subsequent projects as well.
Start early, have fun, and discuss questions on Moodle.