Sorry, but how does doing someone (home)work for them help?
Sure, they can blindly turn in this assignment, but what about tomorrow? When the lesson they are going to be taught is meant to build on what they learned today. Well, they didn't learn anything today, so tomorrow is twice as hard.
P.S. Not that I even bothered to look at the code though, so don't think I'm approving the way you did it, either.