Here the explanation needs to cover not so much the code itself, but the organization of the code and the plan that produced it. For larger programs, especially programs that are divided into multiple files, a couple of pages on planning, organization, and so on are appropriate. For these larger problems, you must describe your thinking at least as well as your code. It is as bad to write too much explanation for a simple solution as to write too little explanation for a complex solution. Good programming style and documentation are essential ingredients in a readable assignment.
Good style includes the use of functions, modules, and abstract data types where appropriate.
Select algorithms appropriate to the task at hand, and make your code structured and easy to read. Good use and placement of documentation is vital. Lots of comment text does not necessarily mean good documentation. Documentation should should focus on high-level issues like design and organization, data representation, and data invariants. As noted above, even programs that run perfectly will lose points for poor documentation.