What can't you produce and what did you try to reproduce it? I suggest you start with the version of the code I provided above.
Note, I am not going to hand the answer to you. If you can't figure this out for yourself you have no future as a software engineer. You need to learn to think for yourself and experiment with your code to figure out where it is going wrong. A good integrated development environment will help you a lot. I suggest Komodo IDE.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond