Funnily enough, it's homework that is supposed to teach the ability to do hard and boring mental work for long periods. There's not enough time or peace to do that in class. And if you don't learn how to work hard, you don't learn how to learn. A lot of people learn that the hard way by flying through the easy school years and then hitting a hard wall when university level assignments can't be just winged without hard studying.
(Or at least they used to.)