2

In pset1 mario more problem i'm getting these errors. I don't understand the errors and how to correct this.

:( handles a height of 2 correctly
   \ expected output, but not " #  # \n##  ##\n"
:( handles a height of 23 correctly
   \ expected output, but not "                      #  #             ..."

3 Answers 3

5

Hmmm, this looks like a unique problem. ;-) check50 expects very exact output. That means that any missing or extra content, like whitespace, prompts, punctuation, characters, spaces, or anything else will almost always cause a fail.

In looking at the output, I'm thinking that the problem is the spaces that are printed after the last # and before the carriage return on each line before the last line of the pyramid. But, I could be wrong.

Try not printing the trailing spaces and see if that fixes it.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

4
  • I don't understand
    – Israt
    Commented Mar 4, 2017 at 13:53
  • What don't you understand? Don't print the spaces on the right side of the pyramid. Printing a space and not printing anything are not the same. check50 is detecting the spaces. For clarity, lets substitute x for spaces. In a pyramid of height 2, your code prints x#xx#x\n when it should be x#xx#\n Note the last x in what would be your code's output. Don't print it.
    – Cliff B
    Commented Mar 4, 2017 at 14:03
  • Thanks now it works.
    – Israt
    Commented Mar 4, 2017 at 14:09
  • I had the same problem. I luckily found this page before wasting too much time on this. Thank you!
    – Shreeraj
    Commented Jun 7, 2017 at 23:16
3

Ya I had the same problem, you can't print spaces on the second triangular block. Thats why it works for 1 in the checker but not 2 and 23. They should really specify this is in the problem not to print trailing spaces on the second triangular block.

1
  • Agreed, ultimately what you see on the console is exactly the same. I wasted quite a lot of time because of this problem! Commented Mar 31, 2017 at 8:03
0

This mistake non obvious and can confused especially when you have same outputs after checking but system has return the mistake.

Like it shown on this screenshot.

Be sure that inside you code you have something like

{
 printf("");
}

instead

{
 printf(" ");
}
0

You must log in to answer this question.

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