HW1: Python Fundamentals
Assigned: 1/27/2026
Due: 2/5/2026, 11:59 PM (Submit on Gradescope, see Ed for detailed instructions)
Feedback Returned By: 2/10/2026
Overview
The goal of this assignment is to help you practice the fundamentals in Python programming through some knitting-themed exercises. If you would like to practice more, you can look for the Exercise sections at the end of corresponding chapters of the textbook Think Python 3e.
Competencies and Evidence Points
HW1 maps to 2 Evidence Points under the Programming Fundamentals competency and 1 Evidence Point under the Software Engineering Practices competency.
Programming Fundamentals (2 Evidence Points)
EP1 — Variables, Expressions, Basic Computation (Task 1)
Satisfactory work shows you can:
- Use meaningful variable names and correct arithmetic
- Handle types correctly (int vs float) and do any needed conversions
- Show clear steps (intermediate variables) and produce correct results
EP2 — Functions with Parameters + Return Values (Tasks 2–3)
Satisfactory work shows you can:
- Define functions with appropriate parameters and return values (not just
print) - Write helpful docstrings (what it does, params, returns)
- Reuse functions instead of copy/pasting logic (code modularity)
- Correctly handle multiple return values (tuple unpacking) and explain basic scope (local vs global)
Software Engineering Practices (1 Evidence Point)
EP3 — Testing, Debugging, and Code Quality (Task 4 + overall quality)
Satisfactory work shows you can:
- Write multiple, meaningfully different tests, including edge cases
- Identify and fix multiple bugs systematically, and explain why each bug breaks things
- Maintain readable code: consistent style (snake_case), clear names, appropriate amount of comments (explain not obvious parts and not too extensive), and required citations if you used any sources
Preparation Before You Start
This assignment will be completed by editing a Jupyter Notebook file comp116-hw1.ipynb that will be available on Ed Discussion > Resources (download link here).
First, make sure the environment setup we went over in Lecture 1 was completed. It was a bit rushed during the lecture so more detailed instructions have been posted to Ed Discussion: Python Setup and First Program (Lecture 1 Supplemental).
Second, let’s build some file structure for this course. If you do not yet have a folder for this course, you can create one. Next, create a subfolder named assignments, or something similar like homeworks. Finally, create a hw1 subfolder under the assignments subfolder,
and download the comp116-hw1.ipynb file to the hw1 folder.
You can now use VSCode to open the folder of this course, and navigate to open the Jupyter Notebook for this assignment. Don’t forget to select the comp116 kernel when you need to run the code cells in the notebook!
How to Submit
Go to Moodle and find the Gradescope link for “HW1: Python Fundamentals” and upload your completed comp116-hw1.ipynb file to Gradescope. Please keep all the cell outputs instead of clearing them before you submit.
Questions? Post on Ed Discussion or come to office hours!