That's the key skill I think, when you learn to program. Being able to take a problem and decompose it into sub-problems that you solve independently of each other. Then taking these pieces and reassembling to solve your original problem.
The problem with sites like Codecademy is that they teach you the vocabulary and syntax of the language, but they don't tell you how to order a meal in the language (for want of a better analogy).