How does Codecademy check my answer?

Question

How does Codecademy know if my answer is right or wrong when I run my code?

Answer

Codecademy runs tests behind the scenes to ensure that your code meets the requirements of the exercise or project you’re working on. If you think you have followed them and see an error or warning, be sure that you’ve done the following:

  1. Use the same variable names requested by the instructions

  2. Assign the same values requested

  3. Look for any missing spaces, capitalization, and/or punctuation if you’re writing a string

A super common mistake is writing something like “toy story” when the behind-the-scenes tests are checking for “Toy Story”. This eye for detail comes in handy as a programmer when you’re trying to debug your own code!

29 Likes

There is a file called test.txt which is the code to check your answer. If you can’t see multiple files, then codecademy is behind the scenes. That is what I know.

8 Likes

Is there a way to see what type of check is done or the code used to check ? I mean can we see the test.txt somehow?

Behind the scenes is code that is run against the user’s code to check that certain things are right. This is called an SCT - Submission Correctness Test - and it’ll check things like the output of your code, for example the value of variables, to make sure they’re correct. There’s also a syntax checker to make sure all of your spelling or keywords, punctuation etc. is correct, but that’s a different thing.

6 Likes

Can anyone please make me understand this part?

4 posts were split to a new topic: Zip/List - Python 3