Pre-exercise code (PEC) is code that is executed each time an exercise gets initialized. This code is not visible to students, and usually consists of dataset and package imports. DataCamp's content guidelines limit you to 15 lines of solution code per exercise. This limit does not apply to pre-exercise code, which exists to ensure that students can direct their focus towards learning the core concepts being taught in the exercise and avoid getting distracted by preprocessing code.

Good ideas

  • Use comments in pre-exercise code. Though this code will not be seen by students, adding comments will make it easier for us to review your content.
  • Use the Context section to tell students about relevant packages, datasets, and functions that have been pre-loaded for them in the pre-exercise code.
Did this answer your question?