Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics Daily Exercise Program Conditionals

Quiz processing doesn't seem to be working

I ran my code for the code challenge in a workspace and it worked. However, it doesn't "pass" the quiz. When I check the quiz console preview, the display adds the integer "2" at the very end of "Treasure made the Honor Roll" (so it reads "Treasure made the Honor Roll2". However, this doesn't happen in the workspaces console. Thoughts?

<?php
$studentOneName = 'Dave';
$studentOneGPA = 3.8;

$studentTwoName = 'Treasure';
$studentTwoGPA = 4.0;

//Place your code below this comment
if ($studentOneGPA == 4.0) {
  echo "$studentOneName made the Honor Roll";
  } else {
  echo "$studentOneName has a GPA of $studentOneGPA";
}

if ($studentTwoGPA == 4.0) {
  echo "$studentTwoName made the Honor Roll"; 
} else {
  echo "$studentTwoName has a GPA of $studentTwoGPA";
}
?>

Tagging Alena Holligan

The preview is showing a 2 at the end of the output. It doesn't seem to be affecting the challenge, at least for me, but it could be confusing that it's there since there's nothing in our code to produce it.

7 Answers

Hi Sherrie,

I'm not sure about the 2 at the end. It could be something from the tester.

You have "Honor Roll" instead of "Honor Role"

Your code should pass after that change.

Alena Holligan
STAFF
Alena Holligan
Treehouse Teacher

I thought we had already fixed these, but I believe I got all the typos fixed now. I'm sorry about that.

Thanks Jason.

Changing "Honor Roll" to "Honor Role" (which was a typo in the original instructions) doesn't (and shouldn't) make a difference: because it's all contained in a string.

Plus: remember, it passed fine when I put the code into the prior video workspace to test it. I've contacted Support.

You're welcome.

I checked the instructions again and it does say "Honor Role"

In general, it does make a difference if strings don't match exactly. This applies to most code challenges. The challenge tester is comparing the output of your program against what it's expecting the output to be. In this case, it didn't match exactly.

It's not that what you wrote is wrong. It is a valid program and it would run in workspaces without any errors. It's just that it didn't meet all of the requirements.

Occasionally, a code challenge will let you put whatever string you want but this is not common.

Hi Jason: In my reply above I write that the same error occurs when "Role" is used or "Roll". Doesn't make any difference.

Note: There were previous noted issues with this quiz, of a different sort, which were resolved.: https://teamtreehouse.com/community/not-sure-whats-wrong-with-my-code-3

This seems to be a new issue potentially. Alena Holligan can you take a look? Thanks!

Maybe it was a temporary error.

I just tried pasting your code into the challenge. It passed as soon as I changed "Roll" to "Role" in both places.

Thanks Jason. I just tried it again in Safari and Chrome and the same error is occurring.... (The digit "2" appears at the end of the second line in the code preview and the code won't pass.)

Sorry you're having trouble with this.

I use firefox and you could try that. I just tried it in chrome and it's passing for me. Or you could try clearing your cache in chrome in case that has something to do with it.

I do get the "2" in the preview the same as you but it's not preventing me from passing.

If you want, you could copy your code from the challenge after you get your error message and then paste it here. Then I'll copy/paste it to see if it passes for me.

Hi Jason: It doesn't work in Firefox either. I'm using the same code I pasted above.

I finally got it to pass using Chrome Incognito and adding the typos back in: "Role" in instead of "Roll."

Ugh.