Can I include code in the exercise context?
We highly recommend including code in the exercise context, especially in intro courses.
You have two good choices here. Either you can include a general code pattern that the students have to make more specific in the exercise, or you can use a concrete example that is different from the one that the students have to write in the exercise.
For example, suppose the objective of the exercise is for students to be able to select the
date columns from a Pandas DataFrame named
# Select id and date columns from customers
The code pattern approach would be to include something like the following.
# Select multiple columns from a DataFrame
The concrete example would be include something like this.
# Select product_name and quantity from orders