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
Andrew Gay
20,893 PointsCode Challenged
I have a challenge for the development team which would consist of a huge rework on the code challenge engine. I constantly run into issues with "incorrect" submissions when it is truly the engines incapability of running outside the specifics of the challenge.
Example:
You are given a variable to start with and the challenge asks you to assign a few values to it (Array).
Given:
var mixture;
Correct Answer:
var mixture = [etc,etc,etc,etc,etc,etc];
(Assume etc are just values such as 15, 'c', and "Hello world")
My answer:
var mixture;//array list of etc.
var etc1,ect2,ect3;//values
etc1 = "HI";
ect2 = false;
ect3 = 15;
mixture = [ect1,ect2,ect3];
I cut the code short because I soon start developing mini little programs with each challenge that goes outside the question of the challenge, but when i am complete over 50% of the time the challenge WILLNOT accept the answer even if it has the same output.
Actual example, code challenge Creating_Arrays This Line of code will execute properly
var mixture,s1,s2,s3,n1,n2,equal;
n1 = 0; //assign to see if would pass the code challenge
n2 = 0; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
equal = false;
s1 = "What is number 1?";
s2 = "What is number 2?";
s3 = "Your numbers are Equal";
mixture = [s1,s2,s3,n1,n2,equal];
var guides;
n1 = prompt(s1);
n2 = prompt(s2);
if(n1 == n2)
{
equal = true;
alert(s3);
}
But move some stuff around and it wont.
var mixture,s1,s2,s3,n1,n2,equal;
n1 = 0; //assign to see if would pass the code challenge
n2 = 0; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
equal = false;
s1 = "What is number 1?";
s2 = "What is number 2?";
s3 = "Your numbers are Equal";
n1 = prompt(s1);
n2 = prompt(s2);
if(n1 == n2)
{
equal = true;
alert(s3);
}
mixture = [s1,s2,s3,n1,n2,equal];
var guides;
I just believe the code challenge engine needs some tuneups.
3 Answers
Tom Bedford
15,645 Points"I soon start developing mini little programs with each challenge that goes outside the question of the challenge"
You knowingly add unneeded code and the challenge doesn't accept it. Therefore the code challenge engine needs fixing?
I don't understand why this is needed.
As you are aware of what you are doing to "break" it you could easily avoid the situation.
Andrew Gay
20,893 PointsSo when, for whatever reason, I stumble upon my next challenge and see how to utilize multiple skills I have learned..... sigh I have run into this issue quite a few times, and yes I can get around from "breaking" it but I don't know if everyone else can or has.
If I had the ability to develop on the code challenge engine and make it user friendly so if bob wants to rename the variables he is able to without causing the submission to fail I would.
There is ALWAYS another way to program the same thing.
I personally disagree with declaring and assigning variable on the same line. I also hate hard coding. So if it says assign 2 numbers I allocate the space for those two numbers and prompt a user for what they are or read off a file.... It just habit, that I consider to be good habit.
Tom Bedford
15,645 PointsI wouldn't want to discourage you from using any of your knowledge. You have the freedom to use any code you like in a text editor in your own environment and it's a great idea to do so.
Is the best place to play around with code in the answer to a specific question for a specific course?
The code challenge premise is very simple, you answer the question they ask you. Wittingly adding superfluous code will not help you pass challenges. Answering the questions as intended should not inhibit your ability to use your knowledge outside of the code challenges.
The challenges are to test basic knowledge of the material. If you wanted to develop the ideas from the challenges further you could always write it up and share the code on the forums.
James Barnett
39,199 PointsJames Barnett
39,199 Points>"I soon start developing mini little programs with each challenge that goes outside the question of the challenge"That's what codepen is for