Friday, December 18, 2009

Homework

I spent a lot of time this week working on the count function in the ch. 7 exercises, so I still have some problems to do. I'll try to work on them over the weekend. From now on I will try to avoid this by spending only a certain amount of time on a single exercise. If I get stuck I'll ask for help rather than continue to work on my own. I hope that this will increase my efficiency in the following chapters.

Monday, December 7, 2009

Ch. 7 Exercises

Here are the Ch.7 exercises - http://docs.google.com/View?id=dgc44sfk_101f246xmxs

Suggestions: Chapter Summaries

I think it would be a good idea to put a chapter summary before each chapter. It would help us know what to expect as well as make it easier for us to go back and review it. I also think it would be easier for me to understand the new codes  if there was an example of the output it would produce, especially for things like...

index = 0
while index < len(fruit):
    letter = fruit[index]
    print letter
    index += 1

...you explain what the output is, but it's difficult to understand without a visual picture of what it's supposed to do. It would be more clear if you showed

index = 0
 while index < len(fruit):
     letter = fruit[index]
     print letter
     index += 1
 
b
a
n
a
n
a

 

Thursday, November 19, 2009

Finally finished

I finally finished chapter six. The exercises in Ch. 6 were really hard for me. Hopefully I'my just not used to thinking with computer programming and will get better with time and practice. 

Friday, November 13, 2009

???

I wrote this for the num_even_digits function
        count = 0
        while n:
            n = n/10
            if n % 2 == 0:
                count = count + 1
        return count


but whenever I doctest it, it says
File "ch06draft.py", line 7, in __main__.num_even_digits
Failed example:
    num_even_digits(1357)
Expected:
    0
Got:
    1






why?

Friday, November 6, 2009

Monday, November 2, 2009

interesting...

after playing around with the sequence(n) function from ch. 6,
I found that sequence(5/9) creates an infinite loop of zeros. I just thought that was interesting...