(full first and last name)
UCSD email address: @ucsd.edu
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h03: Guttag, Chapter 3

ready? assigned due points
true Tue 08/02 09:00AM Wed 08/03 09:00AM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

Bring this with you to your first lecture on the due date indicate.

Please read Chapter 3 in the Guttag textbook, then answer these questions. Note that a few of the questions need to be done in the computer lab with Python available.

  1. Section 3.1 describes "exhaustive enumeriation"
    1. (10 pts) What does the word "exhaustive" mean in this context?
    2. (10 pts) What does the word "enumeration" mean in this context?
  2. Read Section 3.3 about Floats and Binary. Then answer these questions:
    1. (a) (10 pts) Try the experiment that Guttag outlines at the start of Section 3.2, i.e. type in and run the Python code. Do you get the same result he did, or something different? Describe your findings.
    2. (10 pts) What is the decimal equivalent of 11010 ?
  3. (40 pts) Read sections 3.2 and 3.4 about two ways of computing square roots. Reading those sections may help you in the following exercise.

    Here is a cyber-dojo practice session: based on the finger exercise from Section 3.1 of Guttag’s book.

    This version is slightly different: instead of printing out the results, we return them as the first two elements of a list. I’d like you to try the exercise in cyber dojo–but FIRST, try writing out a solution the problem below. Here is the “stub” of the Python function. Underneath it, write your “first attempt” at a final correct solution.

    Then, try either testing your solution in cyber-dojo.org by typing it in immediately, or by incrementally developing a solution–one that passes one test case at a time. Then write down your FINAL correct solution. It’s ok if your first attempt doesn’t work right. If your final solution still isn’t working at the time the homework is “due”, that’s ok too. I’m more interested in your learning process than your outcome. If it doesn’t work, we can look together at why, and what you need to learn to be able to write a correct solution.


    def findRootPwr(number):
      return [-1,-1]
    First Attempt Final Correct Solution

  4. (20 pts) If your first version worked, reflect on what you had to do to get a working version on the first try. If the first version didn't work, but your subsequent attempt did, reflect on what you had to adjust in your thinking to get to a working version. If your code still doesn't work, reflect on your process up to this point.