Do not post your homework assignments and expect us to do them for you. We do not encourage cheating on these forums, and how are you supposed to learn if you're not doing it for yourself?
While direct cheating is discouraged, collaboration is no problem. Instead of asking for something directly, you could say "I have to do this, and I'm thinking about doing it this way, but are there any better methods?" You have clearly demonstrated you know at least what you're talking about, and at the same time, attempted to improve your scripting skills (by looking at superior - if any - methods), which is really what homework is all about.