Knuth suggests, in TAOCP, that the best way to write a program is to write it once, scrap it completely and rewrite from scratch. Very much in line with spending an entire semester making one perfect program vs spending a semester writing and rewriting new programs from scratch.
I used this extensively for code assignments in university, but for a different reason. We had to do most things in C, which can be very painful for prototyping and experimenting with new approaches. So I would solve the problem first in Python, try different approaches, and then after I was happy with the solution I'd write it again in C. Saved me a lot of time in the end.
A better approach in my experience is to grow the whole system from a “skeleton” implementation, refactoring the architecture and code as your understanding grows. With the key use cases being your guide.