Hacker News new | ask | show | jobs
Ask HN: Coding assignments for kids
8 points by brackenbury 4008 days ago
I am teaching a 12-year-old to program in Python. She has learned the basics: input and output, loops and conditionals, arrays, sorting, etc., and she is beginning to learn OOP. The hard part of teaching kids to code is coming up with interesting yet not-too-hard coding assignments. I am looking for ideas.

My approach to teaching is to not focus on learning features of the programming language one by one, but to solve interesting problems, and learn programming language features necessary to solve the problem. To keep kids interested the problems have to be relevant and understandable and somewhat interesting.

Here are some examples of programs she has already written: Number guessing game. Calculating BMI (Body Mass Index). Celsius to Fahrenheit conversion. Add 8.75% sales tax to calculate total price.

I now need some harder assignments and I am running out of ideas.

12 comments

I used to tutor a 12 year old and a 9 year old in Python. Implementing games is a great way to go for a big project that they grasp well, just ask them for games she knows! Think about simple card games first, and if you really want to push her on OOP you can move on to complex things like implementing Monopoly or Battleship, or... you get the gist.

The only downside to this games approach is that unless you structure the process right, it might take a few sessions to get anything that feels even remotely like a game, and the kids can get bored.

Good luck!

Three things which worked for me when I was a kid:

- Games - Pretty pictures - Music

Someone suggested python processing. This might be cool. Also, pygame can be fun. For games, you could introduce the kid to the game of Nim, learn a strategy to always win, and the kid can program the strategy. Make it a real game that someone might load up and play, with whatever graphics, sound, and experience the kid wants.

Having the computer be the blackjack dealer would be another option.

Perhaps an easy an interesting thing to do is to solve an equation looking for a fixed point. For example to solve x=x^2 if you iterate x_(n+1)=x_n^2 then you obtain the solution 0 (in case your initial x is between -1 and 1), then you thing about looking for x = sqrt(x) and discover that it converges to 1 if you choose x1 > 1. This is simple and make you thing a little the power of iterating for solving certain types of problems like equations.
Have her make a madlib script. Fixed at first, where it prompts for a specific list of word types, then prints the madlib. Then have her extend it so it loads a madlib template file to determine what to prompt the user for.

Since she's got the basics of conditionals, she could make a simple text based choose-your-own-adventure type RPG.

Another book like this: "How to solve it by computer" see: http://www.amazon.com/Solve-Computer-Prentice-Hall-Internati...
Let her write the programs SHE wants to write.

Now, of course, the difficulty here is that the young programmer may want to write programs that are beyond his knowledge and abilities. For example, I wanted to write a basic interpreter, and not having recursion, I had a very hard time with parenthesized expressions. I also wanted to do a 3D universe simulation, way beyond my and my computer capabilities at the time. :-)

But as an experienced programmer, you can find out what she wants to program, and direct her teaching to let her make progress toward this goal.

The twenty question game. You thing anything then it ask you about a question to classify it correctly.
When I was a kid, all I wanted to do was program games. If I had been made to program anything else, I probably would have lost interest. A twelve year old doesn't need to know OOP or best practices, a twelve year old needs to have fun
We're still trying to figure out coding assignments simple enough for adults who present themselves as career programmers.
Compound interest.
Compound interest