News for hackers. Stuff that matters.

Ask HN: Coding assignments for kids

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.

( 13 comments | 8 points | on HN )
Re:Ask HN: Coding assignments for kids by avyfain on Friday July 03, 2015 @04:50PM (#9827885)
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!

Re:Ask HN: Coding assignments for kids by clintonc on Friday July 03, 2015 @06:44PM (#9828323)
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.

Re:Ask HN: Coding assignments for kids by noreasonw on Friday July 03, 2015 @05:01PM (#9827932)
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.
Re:Ask HN: Coding assignments for kids by cholmon on Friday July 03, 2015 @04:51PM (#9827891)
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.

Re:Ask HN: Coding assignments for kids by aheilbut on Friday July 03, 2015 @06:23PM (#9828251)
Re:Ask HN: Coding assignments for kids by petilon on Friday July 03, 2015 @09:35PM (#9828787)
Another book like this: "How to solve it by computer" see: http://www.amazon.com/Solve-Computer-Prentice-Hall-Internati...
Re:Ask HN: Coding assignments for kids by brudgers on Friday July 03, 2015 @06:24PM (#9828256)
Re:Ask HN: Coding assignments for kids by informatimago on Saturday July 04, 2015 @04:18AM (#9829622)
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.

Re:Ask HN: Coding assignments for kids by noreasonw on Friday July 03, 2015 @05:10PM (#9827968)
The twenty question game. You thing anything then it ask you about a question to classify it correctly.
Re:Ask HN: Coding assignments for kids by camhenlin on Friday July 03, 2015 @07:50PM (#9828521)
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
Re:Ask HN: Coding assignments for kids by CyberDildonics on Saturday July 04, 2015 @12:30AM (#9829207)
We're still trying to figure out coding assignments simple enough for adults who present themselves as career programmers.
Re:Ask HN: Coding assignments for kids by noreasonw on Friday July 03, 2015 @05:19PM (#9828004)
Compound interest.
Re:Ask HN: Coding assignments for kids by noreasonw on Friday July 03, 2015 @05:19PM (#9828007)
Compound interest