One thing I struggled with in my earlier coding days was deciding what to build. The best approach is to build something that seems a little out of reach. It'll give you a great confidence boost once you've built it.
Hacker School exposed me to tons of different ideas students were thinking about building so I've listed 5 that would be a good challenge for someone learning to code to build.
A Mini Search Engine
Search engines generally constitute a couple of products that work in tandem - a crawler that parses the HTML from a website and database optimized for searching. Both require a basic understanding of data structures and also require managing large amounts of unstructured data. The drawback is that crawling websites takes time (multiply that time by several failed crawls) so patience is required. I would start by crawling two small websites first and then build on top of that.
Products built on top of APIs
This gives immediate access to a ton of organized data. Some of my fave APIs to play with are...
Build a map that plots all the Instagrams within one mile radius, or an app that reads out the weather forecast.
A hashtable is a standard thing to build, it's a data structure that store key / value pairs. It will give you a huge appreciation for what happens under the hood of any programming language. Build a hashtable that allows for fundamental usage - add, lookup, update or delete a key and value. Of course, your hashtable must handle collisons - i.e. how does your table handle an entry into an occupied slot. This Stack answer is super helpful.
Command Line Tool
Build a tool that operates from the command line. I built a phonebook at Hacker School and used a simple text file to store all my data. The cool thing about command line tools is that they are micro-products, so you have to build quite a bit of functionality and it's a great excercise in thinking about how users interact with products.
A GUI (Graphical User Interface) is a fancy word for a native PC or Mac application. In terms of code, it's very similar to a command line tool, but require a bit more work on the front-end and design, and will need more functionality.
Generally, I've learnt that building products are the best way to learn so, when you think to yourself, I don't understand a certain topic (e.g. Inheritence) I've found that the approach of building a tool and forcing yourself to incorporate that topic is much more profound way to learn than just reading / writing code around the topic.