0

I recently started taking the CS50 class at Harvard, and I'll admit that I feel like I have hardly a clue at what I'm doing. It was a huge jump from the Week 0 to doing this. I'm halfway there to solving this, but when I run it through Check50, I get the following errors:

enter image description here

The following is what I have for my code:

enter image description here

I'm kind of struggling right now and cannot figure this out, so I feel like I might just be overthinking things entirely. If anyone has some pointers or advice for this, or for the class and coding in general, that would be great!

1 Answer 1

0

I am on the same course and just finished Problem Set 1, I did the Mario-more version which was very similar to this. I can spot a few issues with your code (p.s. I really wished you copy-pasted the code instead of screenshot).

  1. Line 15 for(space=0; space<height-row-1; row++) I presume this is a typo because you should not be increasing row but space instead
  2. You assigned all your variables at the top (height, row, column, space) but this means the variables assigned at the top will not be looped by the For loops later on (hence why your code only print 1 layer of bricks). You need to assign the variables locally (e.g. only assign height at top, then assign space, column and row in each For loop). I've tested this and once the variables are assigned correctly, the code works.

I would also recommend compile your code and testing it yourself before doing the Check50.

I don't want to just complete this for you but if you need more help, let me know.

You must log in to answer this question.

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