Teach a class with a notebook

Build a Python lesson with a chart, fold the solution, share it with a class group and check what a student sees. About thirty minutes.

Goal: a notebook lesson that a class can read, with an exercise whose solution is folded. Time: about thirty minutes. Plan: Studio. Before you start: your students follow you on SeeMyNotes. If you have not made a group yet, step 1 does it.

1. Make a group for the class

  1. Open your people page and choose the Groups tab.

  2. Choose New group, name it "Spring cohort" and create it.

  3. Choose Add people and add your students. Only people who follow you can be added.

See Followers and groups.

2. Create the notebook

  1. Choose New note and title the note "Word frequencies".

  2. Choose Notebook in the mode switch.

  3. Add a text cell with Add text cell and write a short introduction in Markdown.

  4. Add a code cell with Add code cell and paste:

    import pandas as pd
    
    text = "the cat and the dog and the bird and the fish"
    counts = pd.Series(text.split()).value_counts()
    counts
  5. Add another code cell with a chart:

    import matplotlib.pyplot as plt
    
    counts.plot(kind="bar")
    plt.title("Word frequencies")
    plt.show()
  6. Choose Run all. The first run starts Python in your browser. The table and the chart appear below the cells.

Run the cells so their results are saved with the lesson.

3. Add an exercise with a folded solution

  1. Add a text cell: "Exercise: which word appears three times? Write one line of code that finds it."

  2. Add a code cell with the answer:

    counts.idxmax()
  3. Run it. Open the cell's menu and choose Hide as a solution until revealed.

Students will see Solution hidden. Try it yourself first. with a Reveal solution button.

4. Share it with the group

  1. Show the note's Settings panel.

  2. Under Who can see this, choose Groups and pick "Spring cohort".

  3. Confirm. In Views readers get, make sure Notebook is on.

The notebook is shared with the group.

5. See what a student sees

Open the note from a student account that follows you and belongs to the group. The student sees your text, your code, the saved outputs and the folded solution. They cannot run your code and cannot change it. A person outside the group sees nothing.

The solution is folded until the student reveals it.

6. Update the lesson

Edit the notebook and rerun any cell whose result changed. Students see the new version. If a change goes wrong, restore an earlier notebook version from the note's history.

Result

A lesson the class can read with real results, an exercise that invites trying first, and a group that controls who sees it.

Next steps

Related pages