> But you also had to understand the rest of the code in the template.
Not really. They had lots of comments that explained what the code did. You didn't need to read most of the code.
My point is that compared to real university courses, the HW in this course would be labeled as "trivial". Writing those few lines of code was no more instructive than an in class paper test. It's more comparable to answering simple questions than building anything.
I don't think I had to debug even once in that course. It was that easy.
And reading code tends to be a quicker way to learn roughly how something works than writing it from scratch.