Hw2
Homework 2
Functioning Recursively
Submission: submit your solutions to Moodle in the usual way.
Before you start the problems, please be sure to read all of the instructions on this page.
Problems:
- Problem 0: Reading [5 points; individual]
(hw2pr0)
- Problem 1: Writing Recursive Functions (LAB) [30 points; pair]
(hw2pr1.py)
- Problem 2: The Sleepwalking Student [30 points; pair]
(hw2pr2.py)
- Problem 3: Recursive Rendering [35 points; pair]
(hw2pr3.py)
- Problem 4: Recursive Rendering (Optional Challenge) [up to +10 points; individual or pair]
(hw2pr4.py)
- Problem 5: Google’s Secret (Optional Challenge) [up to +15 points; individual or pair]
(hw2pr5.py)Problems 4 and 5 are totally optional extra credit problems using this week’s concepts and some new ideas.
Overall Instructions
Problems 1, 2, and 3 asks you to write several short Python functions and/or English responses. Please place all of your English responses inside docstrings. Please use the function names as stated by the problems — this will help us in grading!
Docstrings and Comments
Every function that you write must have a docstring. The docstring should explain how many inputs the function takes, what these inputs are supposed to be, and what the function returns. The doctring is intended for the user of your function. In contrast, comments in your code are used to explain details that are important to a programmer who might be reading your code (that “programmer” could be you — it’s easy to forget what you had in mind when you wrote your code!). Any function that is doing anything even modestly complex or non-obvious deserves some explanatory comments. We’ll look for your docstrings and comments, so be sure to include them.
A Note on using Recursion
This assignment exercises your facility to write functions recursively. If you have some programming experience, you may be familiar with other, non-recursive strategies for solving these problems. Even if you do know such non-recursive strategies, however, we ask that you use recursion to solve the problems on this assignment. After all, our primary goal here is to practice an important problem-solving concept and technique, not simply to solve these particular problems…
Back to the CSCI 203 home page.