1. Learn
  2. /
  3. Courses
  4. /
  5. Course Creation at DataCamp

Exercise

Submission Correctness Tests (SCTs)

Though they are not your responsibility, Submission Correctness Tests (SCTs) are integral to DataCamp. They allow for robust checking of learner-submitted answers against the provided solution code.

For example, this SCT checks mean_vec robustly using check_correct().

ex() %>% check_correct(
    check_object(., "mean_vec") %>% check_equal(),
    check_function(., "mean") %>% 
      check_args("x") %>% check_equal()
)

It first checks if mean_vec is correct using check_object(). If it isn't, it digs deeper and checks that mean() was called, then checks the x argument of mean(). If at any point the learner submission is incorrect, learners see feedback messages that help guide them to fix the exercise.

Let's check out how this SCT works.

Note: The instructions and hint in this exercise give you the final answer explicitly. This is not allowed in normal DataCamp courses!

Instructions

100 XP
  • Play around with passing different numbers in the call to mean(). You'll fail the exercise, but it will give you a chance to see the different feedback messages. Be sure to add commas between the numbers & enter them as a vector using c(): mean(c(1, 2, 3)).
  • Delete the call to mean() to see other SCT messages. Play around with other erroneous code.
  • Once you've tried a few incorrect answers, enter the vector of numbers c(10, 20, 30, 40, 50) into mean() to pass the exercise.