Think like a computer scientist: free, interactive textbook


Originally published at:


No thanks, I’ve known too many computer scientists.


And I’ve seen the code they write :weary:


Me too, and I am one.
I did, however, once write a paper about what’s wrong with how computer scientists think:


Are you trying to sneak in a lesson on recursion?


As an Electrical Engineer, I’d rather not.


A computer scientist’s wife sends him to the grocery store and asks him to get a gallon of milk, and if they have eggs, to get a dozen. He returns staggering under the weight of 12 gallons of milk.


This is actually an incredible book. An older version is what I used to teach myself Python. If you want to learn to code, or to learn Python if you already code, this free book is far better than any of the courses you always see them flogging on the boingboing store.

I didn’t check it, but if this has been updated for Python 3, that is great, because one of the issues I’ve had recommending this to people these last two or three years is that all the examples and all the code you need to run them, was Python 2 only.


Thirteen gallons, surely? :wink:

A computer scientist calls his friend. “My wife just gave birth!” he says.

“Congratulations! Is it a boy or a girl?”



Twelve. She said get a dozen, not get a dozen more.


get_milk(1.gallon) and (get_milk(12.gallons) if eggs.any?)

No? I guess maybe it could be:

milk = 1.gallon && (eggs.any? && 12.gallons)

But then if there are no eggs your husband may return false milk :open_mouth:

That night, the computer scientist attempted to explain if/then/else constructs while his wife threw milk at him.

closed #12

This topic was automatically closed after 5 days. New replies are no longer allowed.