As someone who's been programming for right around 30 years, more than 20 of it professionally, and has written a number of books along the way, I get asked for advice fairly often. One of the questions I get asked most is a variation on this one... for me, the answer is always the same: WRITE A GAME!
What developers often don't realize is that few programming projects touch on as wide a range of topics and disciplines as games do. Things like data structures, AI, file handling, input processing, obviously graphics and sound, networking sometimes, performance tuning... all of this comes into play in a game to varying degrees and in many forms. Very few things you'll ever program in a professional setting will be as wide-reaching... in fact, in my 20+ years of professional development I can't think of a single thing that has!
Even things like usability and UI design, project planning and many other "soft" skills come into play when you're a one-man show.
The best part about a game project is it can be as challenging as you want and it can grow in complexity over time. Start with a simple Pong clone. That's not too tough. But then, update the code to add more intelligent paddle movement of the computer opponent. Then modify it so you can play against a friend over a network. Then change it to a 3D view. And so on and so forth. Each step of the way increases the challenge and also the learning.
Plus, of course, being a game that you're making, it tends to be FUN! Both in developing and testing. It also tends to be very demonstrative in terms of progress... you can SEE what's being produced and little changes in the code can make a big difference on the screen, which makes you feel pretty good and that in turn makes the project continue to be fun to work on, which means more opportunity to learn. Hey, I get paid good money to write financial software all day... I even enjoy it most of the time... but it's nowhere near as gratifying as the game programming I do on my own time!
Also note that you don't need to write the next 3D masterpiece here... in fact, writing a Zork-style text adventure game can be a huge learning exercise on its own, especially if you write a natural language parser (though, again, it's up to you: you can start with a simple keyword analyzer that you can bang out in an hour at most and grow it from there). Graphics and sound are a great learning experience on their own (I can't tell you how much better at math, always a weak subject of mine, I've gotten by working on games!) but they aren't required for a game... though, I've also gotten pretty adept at working in various graphics editors, which definitely has helped me in my day job (I'm still no artist, but I can manipulate existing graphics quite well now, which will make you a more valuable asset as non-graphic artist developer).
Whatever the concept, whatever the toolset, whatever the learning goal, a game is the way to go in my opinion. It's how most of us now old-schoolers got started frankly and it has served us very well over the years. Some of us still write games of course because it's fun and we continue to learn from the experience... and also, especially with the rise of mobile devices, there's an opportunity to make money! Look at some of the recent hit games and it's obvious you don't need to write the next Titanfall to make some good coin. It's a secondary benefit to be sure, but it's nice to know it could be one :)