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
Open your people page and choose the Groups tab.
Choose New group, name it "Spring cohort" and create it.
Choose Add people and add your students. Only people who follow you can be added.
See Followers and groups.
2. Create the notebook
Choose New note and title the note "Word frequencies".
Choose Notebook in the mode switch.
Add a text cell with Add text cell and write a short introduction in Markdown.
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() countsAdd another code cell with a chart:
import matplotlib.pyplot as plt counts.plot(kind="bar") plt.title("Word frequencies") plt.show()Choose Run all. The first run starts Python in your browser. The table and the chart appear below the cells.
3. Add an exercise with a folded solution
Add a text cell: "Exercise: which word appears three times? Write one line of code that finds it."
Add a code cell with the answer:
counts.idxmax()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
Show the note's Settings panel.
Under Who can see this, choose Groups and pick "Spring cohort".
Confirm. In Views readers get, make sure Notebook is on.
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.
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
A quiz that saves scores: App ideas