I have tested every criterion of Mario, and they all are met, but check50 is getting a different output than me. Here is a transcript of what happened.

elephant1123@ide50:~/workspace/pset1 $ ./mario
How many blocks would you like Mario to jump?
elephant1123@ide50:~/workspace/pset1 $ check50 2015.fall.pset1.mario mario.c
:) mario.c exists
:) mario.c compiles
:) rejects a height of -1
:) handles a height of 0 correctly
:( handles a height of 1 correctly
   \ expected output, but not " #\n"
:( handles a height of 2 correctly
   \ expected output, but not "  #\n ##\n"
:( handles a height of 23 correctly
   \ expected output, but not "                       #\n             ..."
:( rejects a height of 24, and then accepts a height of 2
   \ expected output, but not "  #\n ##\n"
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""

I am pretty sure that the problem is my printf ("\n") to jump to the next line, since check50 appears to be seeing the \n even though it doesn't appear when i test it. Does anyone know how to fix this?


Actually, they're not all met. In fact, none of the pyramid outputs meet the program specification.

check50 expects very exact output. Any extra or missing output, prompts, punctuation, comments, or even whitespace, will cause a failure. In this case, there are at least two problems.

Run your program and the staff solution and compare the results. Start with pyramids of height 1 and 2. The problems should be readily apparent when you compare them. Don't assume that your output is correct. Instead look carefully at exactly what it is doing.

The hidden lesson in this program is to learn to write code to meet exact specifications. Close just isn't good enough. While the problems may be readily obvious to some, you need to figure out what is wrong yourself in order to learn all of the lessons in this pset. Hopefully this answer will point you in the right direction.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – kzidane
    Jan 27 '17 at 12:14

It looks like you have given one more space than required.


It looks like you have 1 extra space than required. Try removing that one extra space.

You must log in to answer this question.

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