I'm glad they got caught. That will 'teach them a lesson'! [=they will learn that they should not do that again]
We 'learned our lesson' the hard way. [=we learned from an unpleasant experience]
They studied the 'lessons' [='teachings'] of the great philosophers.
(..) Yeah. Brother and sister. Incharge of discipline. They like punishment, the Carrows. They did that to you? Why? Today's Dark Arts lesson was practicing the Cruciatus curse. On first years. I refused. Hogwarts has changed. Let's have a bit of fun, shall we? (..)2011 Harry Potter and the Deathly Hallows: Part 2