Skip to main content
3 votes

Mario pyramid works, but check50 not buying it

This is a fairly common misinterpretation of the spec. The pyramid should print out so that there are no leading spaces on the last line, no matter how high the pyramid is. This code prints too many ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

mario (less) getting 53% score

Sorry to burst your bubble, but this code doesn't work correctly. It prints a left-justified pyramid. The pyramid is supposed to be right-justified. It prints spaces after the hash marks. They ...
Cliff B's user avatar
  • 69k
2 votes

MarioLess - declaration shadows a local variable error

Look at this code: int h = get_positive_int("What height do you want: "); //print the pyramid for (int h = 0; h < n; h++) It declares h (as an int) twice. Change one of them. Also, n hasn't ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

Struggling with Mario (less comfortable) loop conditions

Nesting loops to a level of three makes little sense for iterating 2D structures. I think you have to move your innermost loop out, directly in front of the loop it's currently in, so that you have ...
Blauelf's user avatar
  • 21k
2 votes
Accepted

Error: use of undeclared identifier 'j'

You did use an undeclared identifier j in the second for loop. It isn't created until and only inside the following 3rd for loop. The compiler never lies. It might mislead on occasion, but it never ...
Cliff B's user avatar
  • 69k
2 votes

Cannot compile Mario (less comfortable) in PSET 1

if you successfully ran "make mario", why are you running clang? The make command is doing all the compiling and linking for you. Without the correct compiler flags in the command, it won't ...
Cliff B's user avatar
  • 69k
2 votes

Stumped on PSET 1 Mario Less Comfortable

Looks like you have an extra for loop there, which will cause the entire thing to loop l times when that's probably not what you intended.
Fuelled_By_Coffee's user avatar
2 votes
Accepted

Mario less, struggling with nested FOR loop

Don't stress yourself out too much with trying to understand everything, even after reading up on it--sometimes things only "click" after your brain stops thinking about it. Let's take a ...
Robert S. Pratt's user avatar
2 votes
Accepted

A problem with my code in PSET 1 Mario less comfortable

The problem is in your nested for loop. It prints a space all the way up until i + j <= n - 1. Once this is no longer true, your program exits the loop. Let's look at this in a little more detail: ...
Robert S. Pratt's user avatar
2 votes

Can anyone please help with mario less comfortable?

Simply put, the code doesn't compile, so none of the other tests can be done by check50. Did you actually compile your code and run it first, or did you go straight to check50? The code needs to ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

pset1 mario - hashes output

Here's a hint. How many hashes in the first row? The second row? The third row? Does the number of hashes in any given row have any relationship to the height of the pyramid? Or is the number of ...
Cliff B's user avatar
  • 69k
1 vote

PSet 1 Mario Less - cube instead of expected stair

The inner for loops are all based on height, so they're going to do exactly the same thing on every pass of the outer loop. Every row will look like every other row, so you get a cube. Maybe they ...
Cliff B's user avatar
  • 69k
1 vote

pset1 not printing hashes for mario

Please try to understand the pset questions, once you do take small steps and write down problem requirements in word and then transform those into the code exactly as per the specifications. Follow ...
Saad Dev.'s user avatar
1 vote

Problem with check50's result for pset1 mario less

The problem is the leading spaces on each line. This code will print 6 leading spaces on the first line no matter what. This is incorrect. You could say that your code is simply printing the top h ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

how can i get for it reprompt if the user types negative integer or number more 8 . my code does the oppoiste of what i want it to do how do reprompt

Think negatively! Look at the test that the code is doing: while(n <= 8 && n >= 1 ) This checks that n is in the range that is valid. You want the loop to repeat if it isn't in the ...
Cliff B's user avatar
  • 69k
1 vote

Stumped on PSET 1 Mario Less Comfortable

in your code check the first for loop, why is the counter decreasing ? why do you need 4 for loops? to create the right aligned pyramid you need only 3 for loops. external loop, to count from the ...
Alvaro Barboza's user avatar
1 vote

Pset1 - Mario (less) - White Space

Why are you printing a newline before your pyramid? Remember the spec showed: ~/pset1/mario $ ./mario Height: 4 # ## ### #### check50 will be looking for that.
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

Struggling to align pyramid and check for extra spaces at the end of each line in pset6 mario.py less

Don't make things complicated. for x in range (height): print((height-x - 1)*' ' + (x+1)*'#')
Ojou Nii's user avatar
  • 731
1 vote
Accepted

how do i write pesudocode.txt for Mario? (less comfortable)

You make a new file by clicking the green plus sign at the top, next to where it says the name of the file you are currently on. On your keyboard, then do command shift S. It will give you options for ...
mkg15's user avatar
  • 67
1 vote

are we supposed to use the set from hello.c to begin with Mario (less comfortable) or do we need a new terminal and file?

It's a new program. Start with a new file. You're done with hello.c, but feel free to look at it for any ideas on how to do anything you've done in the past. These instructions are guiding you through ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

are we supposed to use the set from hello.c to begin with Mario (less comfortable) or do we need a new terminal and file?

You don't have to create a new terminal window, but you should only start mario if you're finished with hello. If you're in the hello directory, on your terminal, execute: cd, cd pset1, mkdir mario, ...
mkg15's user avatar
  • 67
1 vote
Accepted

No rule to make target 'mario'. Stuck on where I am going wrong. Cannot compile existing file

The mario file exists in the mario directory, but you are not executing the command in the same directory. You're in the root directory, two directories above mario.c. You need to be in ~/pset1/...
Cliff B's user avatar
  • 69k
1 vote
Accepted

pset6/less/Mario passing all checks, but score at 90%

From the CS50 syllabus: Problems are evaluated along axes of correctness (as determined by a program called check50) and style (as determined by a program called style50), with scores ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset 6 mario, I'm getting wrong ouput

Your code is badly formatted, so it is not possible to reproduce your problem easily. Luckily I know Mario. The range() function starts from zero by default so there are extra lines the solution is to ...
MARS's user avatar
  • 5,169
1 vote
Accepted

PSet1: Mario - Less Comfortable (Too many periods)

for (space = 0; space <= height - row; space++) runs height - row + 1 times (+1 for having <= instead of <). For the first row, you should have height - 1 spaces, but you have height + 1. Fix ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

Pset 1 mario (less comfortable)

I don't think you've quite grasped the assignment. The code is to print out the left side of the pyramid so that it is right-justified. That means that it is supposed to have leading spaces before ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

It doesn't work?!!! (Mario less)

The errors are self explanatory. The code accepts 0 as a valid input, it should reject it. In all the pyramids that the code prints, the first line has two #'s. There should be only one. Is it ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

How to print out hashes in mario(less comfortable)? (2019)

You assign the height to variable i, and on the next line you overwrite it with 0, throwing away the user input. Make the row counter a different variable, and name your variables according to their ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

Errors while check50 in Pset1 mario less, expecting suggestions

Let's have a look at one of those error messages: :( handles a height of 2 correctly expected " ##\n###\n", not "##\n" This means that for a height of 2, the test expected to get: ## ### while ...
Peter Pesch's user avatar
  • 1,009
1 vote

I get an error like make: ***No rule to make target 'mario how to resolve it.'

cd (change directory) into the directory where mario.c is located (type ls and it should show up), then enter make mario.
Blauelf's user avatar
  • 21k

Only top scored, non community-wiki answers of a minimum length are eligible