Exercises

Every course is organized into chapters consisting of one or more exercises. If you created a course repository through www.datacamp.com/teach, your chapter files will already contain some DataCamp exercises to start from.

DataCamp supports variety of different exercises, each of which consists of several blocks. Some types of blocks are used by many exercises, while others are exercise-specific. Whenever possible, choose a coding exercise over a non-coding exercise: people come to us for hands-on instruction, and having them use what they're learning right away improves retention.

Whatever types of exercises you choose, it is essential that they be reproducible: anyone with the right software must be able to re-run them and get the answer that you expect. The "anyones" you must initially satisfy are your Curriculum Lead, our Content Developers (who will be in charge of final edits and of deploying your course), and our automated back end (which must be able to run your code and its correctness tests unsupervised). This requirement means that it isn't practical to use live data feeds in exercises, since their contents may change outside your control. Instead, unless you have explicitly agreed it with your Curriculum Lead, you should always rely on archived datasets (either those included with the packages you are teaching or those you have explicitly included in your lesson).

Exercise Types

These types of exercises are currently supported:

Type Description
VideoExercise Displays a video exercise
NormalExercise Instructions, exercise, code editor, and console
MultipleChoiceExercise Multiple choice question and console
PureMultipleChoiceExercise Multiple choice question without a console
TabExercise A series of connected sub-exercises
BulletExercise A series of connected sub-exercises

Exercise Header

Each exercise has a header consisting of a title block and a YAML properties defining the exercise:

Video
Normal
MultipleChoice
PureMultipleChoice
## Video Exercise

```yaml
type: VideoExercise 
lang: r
xp: 50 
video_link: //player.vimeo.com/video/160339466
video_hls: //videos.datacamp.com/transcoded/672_intermediate_r/v2/hls-ch1_1.master.m3u8
```
## Interactive Exercise Title

```yaml
type: NormalExercise
lang: r
xp: 100
```
## When to use Python?

```yaml
type: MultipleChoiceExercise
lang: python
xp: 50
```
## Example of PureMultipleChoiceExercise

```yaml
type: PureMultipleChoiceExercise
lang: python
xp: 50
```

Exercise properties

The supported properties differ depending on the type of the exercise:

Block Video Normal MultipleChoice PureMultipleChoice
type :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
key :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
lang :white_check_mark: :white_check_mark: :white_check_mark: :x:
xp :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
video_link :white_check_mark: :x: :x: :x:
aspect_ratio :white_check_mark: :x: :x: :x:
  • type: type of the exercise you are creating as listed in Exercise Types.
  • key: a unique key for the exercise generated by DataCamp. Do not modify or duplicate this key.
  • lang: the language of the exercise (r, python, sql, or shell).
  • xp: the XP the student will receive for solving the exercise.
  • video_link: a link to the video for a VideoExercise.
  • aspect_ratio: the aspect ration for a VideoExercise.

Exercise blocks

Exercises may contain the following kinds of blocks:

Block Video Normal MultipleChoice PureMultipleChoice
title :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
assignment :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
instructions :x: :white_check_mark: :white_check_mark: :white_check_mark:
hint :x: :white_check_mark: :white_check_mark: :white_check_mark:
pre_exercise_code :x: :white_check_mark: :white_check_mark: :white_check_mark:
sample_code :x: :white_check_mark: :x: :x:
solution :x: :white_check_mark: :x: :x:
sct :x: :white_check_mark: :white_check_mark: :x:
possible_answers :x: :x: :x: :white_check_mark:
feedbacks :x: :x: :x: :white_check_mark:

Note

TabExercise and BulletExercise are not included in the comparison table because they are combinations of other exercise types.

  • title: title of the exercise shown to students taking the course.
  • assignment: describes the task the student is to solve.
  • instructions: the actual question or task for the student. In the case of a MultipleChoiceExercise, the instructions list the options from which the student can choose.
  • hint: a hint the student can request.
  • pre_exercise_code: code run in the background when the exercise is loaded to load necessary libraries, define variables, etc.
  • sample_code: starter code made available to the user at the beginning of the exercise.
  • solution: a correct solution to an interactive exercise. DataCamp's back end runs this code when building the course to check that the exercise's submission tests run correctly.
  • sct: the exercise's submission correctness tests (described below).
  • video_link: the link to the video (VideoExercise only).
  • aspect_ratio: the aspect ratio (VideoExercise only).
  • possible_answers: a list of possible answers and a correct answer (PureMultipleChoiceExercise only). See How to create PureMultipleChoiceExercise for details.
  • feedbacks: a list with feedback for each possible answer (PureMultipleChoiceExercise only). See How to create PureMultipleChoiceExercise for details.

Submission correctness tests (SCTs)

NormalExercise and MultipleChoiceExercise require you to write Submission Correctness Tests (SCTs) to assess whether the student gave the correct answer. Writing good SCTs is challenging, so DataCamp has developed technology-specific packages to simplify the task:

Language Source Documentation
R testwhat GitHub wiki
Python pythonwhat ReadTheDocs
SQL sqlwhat ReadTheDocs
Shell shellwhat ReadTheDocs

results matching ""

    No results matching ""