First of all, we as a community should guide our beginners. The past few weeks I've been wondering if a guide to formatting and asking good questions. The help center only goes so far. We should be able to post this whenever a new user doesn't follow these "standards."
One thing that we should teach is how to use coding conventions. White space helps out reading if done correctly. We should teach how to use the site formatting tools and enable syntax highlighting. We can help them along the way with most of this with edits. How this relates the the question is: we should add a section to it explaining to post code inside the question.
If a question that has too much code, we should add a close reason to the system for no prior effort for not locating the part of the code that isn't working. This close reason would apply to the question you mentioned. It is not acceptable to post one thousand lines of code and then expect us to fix it.
However, I do not believe we should delete these questions with lots of code. We should first move the code to the question, and only delete if it expires and we don't have code. The OP could still debug the code and go through the process of reopening if they wanted to. Deleting will just scare away new users. We can create guides to help them, but we shouldn't scare them away, nor shoold they make us do all the work.