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?
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...
I found that sequence(5/9) creates an infinite loop of zeros. I just thought that was interesting...
Sunday, November 1, 2009
What I've learned so far
Everything I've learned so far has been completely new to me, I've learned:
- the basics of how to use vim and python.
- about values, variables, types, statements, expressions, and the various operators and basic functions.
- about function definitions, parameters, and arguments.
- about boolean values and expressions and functions and logical operators.
- about the "if", "else", and "elif" operators and conditionals.
- the difference between "print" and "return".
- about converting types and the very basics of using GASP.
- about developing programs and program composition.
- about boolean functions and function types.
- (and finally) about using triple quotes and doctesting.
1st Quarter Experience
I didn't really know what to expect from How to Think Like a Computer Scientist, but I have been a little surprised by what I've learned so far. With every knew chapter I see the relationship between what we've learned in the earlier ones. It all fits together very nicely, but I still don't really know where we're going. I've got the first puzzle pieces fitted together, but I don't know what the big picture looks like yet.
Ch. 5 Exercises
These are the ch.5 exercises, http://docs.google.com/View?id=dgc44sfk_74hhjrf3d4
It took me awhile to write the function def for f2c, but that was mostly b/c I didn't quite understand how to use the "round" function. I also came across a few errors that I had no explanation for, but I found that they were mostly syntax errors. Hopefully, overtime I will become more accustomed to spotting syntax errors and eventually be able avoid then entirely.
It took me awhile to write the function def for f2c, but that was mostly b/c I didn't quite understand how to use the "round" function. I also came across a few errors that I had no explanation for, but I found that they were mostly syntax errors. Hopefully, overtime I will become more accustomed to spotting syntax errors and eventually be able avoid then entirely.
Subscribe to:
Posts (Atom)