EECS110 Homework 2, Spring 2018
Due: 11:59pm on Sunday 04/22
Submission:
submit your solutions at Canvas
Problems:
Problem 1: Integration! (hw2pr1.py
) [35 points;
individual or pair]
Problem 2: The Sleepwalking Student (hw2pr2.py
) [35 points;
individual or pair]
Problem 3: Recursive Rendering (hw2pr3.py
) [30 points (+ 15
extra points); individual or pair]
Each of these questions asks you to write several short
Python functions and/or an English response. Please place all of your answers
for problems 2 and 3 into a Python plain-text file named hw2pr2.py
,
hw2pr3.py
(changing
the problem number as appropriate). Please use the function names suggested by
the problems - this will help us grade things!
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 the 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... .