Just came back from writing the quiz.
Halfway through the explanations of sum_up, I realized I read the code wrong.
And then time ran out.
So I realized that sum_up(2) = 3
but I put 2.
I'm a little disappointed in myself, but at least I know what I did wrong?
Instead of moving up to the inner while loop, I went back to the line that assigns j to i
So that's why I got the wrong answer.
So the general formula was supposed to be
s = n + (n-1) + (n-2)
i.e. s = n(n+1) / 2
I hope it doesn't affect my mark too much.
Now I'm getting even more disappointed in myself.
I'm feeling a lot like Liz Lemon right now:
Should have spent more time thinking about the code.
No comments:
Post a Comment