1

I've completed the mario program and it works fine! When I re-checked the pset specification page, I found that I should accept

non-negative integer no greater than 23.

So I edited my code to accept 0, which is a non-negative integer. And I'm getting this error when checking my program with check50

 :( handles a height of 0 **correctly**
     \ expected an exit code of 0, not output of "##\n"

Is the check function wrong? Or is my program supposed to be buggy and giving an error when inputting 0?

1

check50 is not wrong. It's telling you that it doesn't want the first level of the pyramid printed out, if it gives the input 0.

It's not telling you to throw an error, though. It simply wants your main() function to return 0, which is the conventional code for "nothing went wrong, now we're done." Anything other than 0 indicates an error. This makes sense because there are a lot of different ways for something to go wrong, and we can use different numbers to identify specific issues. On the other hand, we really only need one way of indicating success.

1
  • Not convinced this was the issue in the case above. As said below, it seems that the issue is that when 0 is entered as an input, it is printing # # but should print nothing.
    – Happy Chap
    Nov 10 '16 at 18:20
1

When the height is 0, your program shouldn't output anything at all!

Currently it outputs

##

You may try walking through your code assuming the height is 0, see what happens and fix that!

1
  • After a bit of thinking I came to this conclusion ad just erased the part where it checks for "0" Jul 2 '14 at 4:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .