Lecture 2

Jan. 10th, 2010 04:43 pm
winterthunder: (Default)
[personal profile] winterthunder posting in [community profile] intro_to_cs
All right! Hopefully we've all successfully completed Problem Set 0 and are ready to tackle Lecture 2. Note that there is a handout associated with this lecture, and having it printed out before starting is a really helpful thing. Not that I had to stop and print it in the middle of lecture or anything...

Also, since our problem set numbers started with 0, I'm going to put up a post for PS1 this Friday. From that point on, problem sets will go up every other week.







I had one problem with this lecture, and I'm hoping you all can facilitate a light bulb moment. The code example with x, y and z, the fourth one down the page... I can't figure out what the bug was. Is it just because the statements aren't indented, or is there something else?

Date: 2010-01-11 12:10 am (UTC)
jetamors: Yoruichi is really hot (Default)
From: [personal profile] jetamors
That's correct. This isn't a bug in the sense that the program won't run. The problem is that the code doesn't do what we want it to do: return the smallest number under every possible condition.

Consider a case where our intent is different: let's say we decide that if x is not less than y, then we don't care what z is. In that case, this code would be perfectly fine.

Profile

Introduction to Computer Science

July 2010

S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829 3031

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 5th, 2025 12:12 am
Powered by Dreamwidth Studios