Hw2

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:

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.