Coding exercises are the most common type of exercise in our courses. In this type of exercise, the learner writes a few lines of code, submits it, and either a success message or a feedback message is returned, depending on whether the student submission is correct or incorrect. Learners can run their code as many times as they like before submitting it - the submission is tested when a student click "Submit Answer."

The keys to writing good Coding exercises are to provide clear instructions and good sample code. Instructions should be at most four bullet points. The sample code should include code comments that serve as abbreviated instructions and a few lines of sample code to be completed, which contains placeholders (written with underscores ____ ) for the learner to fill in. The difficulty level of the exercise can be adjusted by the number of placeholders provided in the sample code.

Watch the following video to get a clear picture of what a Coding exercise looks like.

Note: Coding exercises were formerly called Normal exercises


At a high level, our guidelines for Coding exercises boil down to the following key points:

  • The context section should be at most 780 characters. Recommended is 540.
  • No more than four instructions per exercise, of length 30 - 480 characters. Recommended is three instructions of 360 characters in total.
  • No more than 15 lines of solution code (including comments) per exercise.

Did this answer your question?