Skip to main content

Describing pre-exercise code

How to explain what you did in pre-exercise code.

Written by Amy Peterson

Question

I loaded some packages and created some variables in the pre-exercise code. How do I tell students that I've done this?

Answer

Add a sentence at the end of the exercise's introductory text (Context block). For example, you could say
​
​pandas  is loaded, and the Titanic  dataset is available in your workspace.

You can also mention the existence of any variables in the Sample Code. For example,

# Titanic is loaded
head(Titanic)

If you created many variables, it could be easier to list them. In R, use ls.str() ; in Python use %who .


​

Did this answer your question?