
Python Exercises for Kids - ingve
http://blog.regehr.org/archives/1300
======
dkopi
Started programming when I was 8 using basic. Things have changed a lot since
then, but one thing probably hasn't: The best incentive I got to continue
learning how to program was my ability to impress others.

I would develop screen savers (Lines floating on the screen, lines being drawn
randomly on screen, ball bouncing off the edges of the screen, flying into a
star-field as the stars move away from the center of the screen), and show
them off to my friends and family. I would develop a small game (spaceship
moves up and down to avoid hitting incoming asteroids) - I'd show it to my
friends. Let my brothers play the game.

These were the type of rewarding tasks that led me to keep on learning and
experimenting.

If you're doing Python - I strongly recommend "Inventing computer games with
python" [https://inventwithpython.com/](https://inventwithpython.com/) Using
pygame, you can get really quick graphical results, and start showing off some
awesome things. I even built a Tetris game based on pygame a while back when I
was learning python myself.

Also - if you're doing turtle programming, check out
[http://pythonturtle.org/](http://pythonturtle.org/) \- an awesome
implementation of turtle graphics for python.

~~~
mavhc
Found out recently pygame works with python 3 now, so that's one hurdle
overcome. msi for 3.4 at
[https://bitbucket.org/pygame/pygame/downloads](https://bitbucket.org/pygame/pygame/downloads)

------
harryf
Most "Teach Kids Programming" are build on the idea that programming means
sitting still in front of a keyboard typing stuff. Most kids under 10 can
manage at most about 15 minutes of that before getting bored and either
wanting to get up and jump around or watch YouTube / play games.

Scratch ([https://scratch.mit.edu/](https://scratch.mit.edu/)) helps a bit but
it's still "stuck in front of a screen" and reaching a "reward", in terms of a
meaningful result takes longer than the average childs attention span.

Best starting point I've ever seen is this "How to Train your Robot" real
world game - [https://drtechniko.com/2014/07/09/teaching-the-how-to-
train-...](https://drtechniko.com/2014/07/09/teaching-the-how-to-train-your-
robot-to-jump-game/) \- which is based on the idea that adults play the robots
and kids get to tell them what to do. That's immediately a fascinating
starting point for kids to hold their interest while they pick up some basic
ideas of logic and creating instruction sets for a 3rd party to execute.

~~~
jvvw
Attention span varies considerably from one child to another.

The 'How to Train your Robot' game appears to be aimed at a 2.5 year old and
as the mother of a 2.5 year old myself, it seems ludicrous to try to get a
child that age into programming.

On the other hand, my 5 year old needs something more than directing robots
around - Robot Turtles is too easy now for example, but he does enjoy playing
with ScratchJr on the iPad, sometimes for quite long periods of time. It also
of course has the big advantage at this age of not requiring literacy.

~~~
harryf
> The 'How to Train your Robot' game appears to be aimed at a 2.5 year old and
> as the mother of a 2.5 year old myself, it seems ludicrous to try to get a
> child that age into programming.

I've found it works best as a party game with a group of kids where it can
have a competitive dimension - whoever can "write a program" to get the
"robot" to achieve some goal fist e.g. navigate an obstacle course and pick up
an object. Even better when kids are in pairs; one pair might focus on
winning, another pair might get absorbed on getting the adult to do stupid
things which is hilarious etc.

And from what I've seen it can be fun for kids up to 10 at least, if you add
some additional dimensions e.g. "robots" that can "fight" by throwing rolled
up paper balls at other.

------
eugenekolo2
I'm sorry but I don't see how these are for kids. "Monte Carlo Pi Estimator"
??

Some stuff kids would enjoy more:
[https://inventwithpython.com/](https://inventwithpython.com/)
[http://www.amazon.com/Python-Kids-Playful-Introduction-
Progr...](http://www.amazon.com/Python-Kids-Playful-Introduction-
Programming/dp/1593274076)

~~~
thomaskcr
It's just a fancy way of saying what it really is (estimating pi with
increasing accuracy using geometry). I remember doing the pencil circle drop
calculation for pi in middle school which is a similar concept just physical
instead of on a computer.

The problem I've found with pygame is that the time from starting to producing
a playable game is too long, the kids get frustrated and lose interest when
you need to type 20-40 lines of boiler plate to just get an image and a moving
character on the screen before anything even happens. I've had much greater
success with "boring" projects that produce the final result in 10-20 lines.

They already have games that we'll never be able to come close to in terms of
quality. There's nothing that I can make in even 20 hours that is even close
to as interesting as Minecraft or a high budget xbox game - there is
effectively a very small difference to them between building a game with
"boring" dynamics and solving math problems.

This mostly only applies to first projects, once you complete a few projects
and have separated out the children who actually enjoy programming - that's
when you can start doing multi-week epics. But you need to build confidence
and give them some easy "wins" before you are going to be able to do that in
my experience.

~~~
eugenekolo2
I agree, it's hard to actually engage kids with boring games, and anything
that involves boiler plate.

The boiler plate should just be hidden away if possible.

I think a small coding exercise that kids would like is something that
automatically solves their simple algebra homework. Although, do 12 year olds
just go on wolframalpha now?

~~~
stdbrouw
> I think a small coding exercise that kids would like is something that
> automatically solves their simple algebra homework.

I don't think recursive tree algorithms and reverse Polish notation, the
bedrock of computer algebra systems, would be so much fun to kids. Could you
elaborate on what you had in mind?

~~~
adrusi
By far the most useful program I wrote as a kid was one that factored
polynomials. It ran on the calculator I was allowed on tests.

------
gragas
I don't see this working well with kids. I'm a course assistant for an
introductory Python course at a {top 5} CS school. It's shocking to see the
sheer lack of intuition and inability to think about loops some beginners
have.

Although now that I think about it, I think I'd trust a 13-year-old with a
fresh mind more than most of the college students I work with.

~~~
dkopi
I sometimes think the best way for people to learn about loops is not to tell
them they exist at first. Give them lots of repetitive assignments, (print the
numbers 1 through 50, or all the powers of 2 until 65536) until they're so
frustrated they start demanding a solution.

~~~
dr_zoidberg
That's just mean, no need to got that high up, and you also risk the students
getting bored and giving up. I'd go to fewer amounts (5 to 10) and then
explain the loop. If they then complain it's complicated you tell them
"imagine you had to copy this thing million times!".

------
raymondh
There are much better resources for kids to learn Python. I recommend Chris
Roffey's excellent series of Coding Club books. They are engaging, well-
written and have more meaningful exercises.

------
truebosko
This is great, thank you! I teach a weekly Python class to kids and have been
slowly refining my curriculum (Shameless plug, the Sphinx docs are up online
here for anyone to critique! [http://justbartek.ca/python-
curriculum/](http://justbartek.ca/python-curriculum/))

One of the more popular exercises thus far for us has been the "Bagels"
program. I can't even remember where I found the game, but they find it a lot
of fun as it mixes a bunch of mental challenges into one program.

[http://justbartek.ca/python-
curriculum/exercises/bagels.html](http://justbartek.ca/python-
curriculum/exercises/bagels.html)

------
truncate
Back when I was kid, I chose Flash programming over C++. It was just more fun,
with results that you could show off to your friends. I didn't care how things
work, I just wanted to build stuff. Once I started building tiny little games,
I automatically started to learn how things work and developed interest in the
science behind it, be it maths, physics or computer science itself. Today, I
would suggest Racket's big-bang.

[1]
[http://www.ccs.neu.edu/home/matthias/HtDP2e/part_one.html#%2...](http://www.ccs.neu.edu/home/matthias/HtDP2e/part_one.html#%28part._.Interactive_.Programs%29)

------
jredwards
Would be an awkward title if you weren't familiar with software development.

------
DanBC
I always thought fractals and similar were great introductory programs for
children.

The fractals need only a few lines of code, with a bit of extra boiler plate.
Tweaking the formula can give dramatically different results. You get to use a
variety of programming concepts in a short program.

Relevant books are

 _Dynamical Systems and Fractals_ (Karl-Heinz Becker, Michael Dörfler) (This
book has extensive Pascal code) [http://www.amazon.co.uk/Dynamical-Systems-
Fractals-Computer-...](http://www.amazon.co.uk/Dynamical-Systems-Fractals-
Computer-Experiments/dp/052136910X)

[http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511663031](http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511663031)

 _Fractals - Images of Chaos_ (Hans Lauwerier) (This book has an appendix of
BASIC code) [http://www.amazon.co.uk/Fractals-Images-Chaos-Penguin-
Scienc...](http://www.amazon.co.uk/Fractals-Images-Chaos-Penguin-
Science/dp/0140144110)

Sadly neither book is suitable for general 11 year olds, but a modern version
certainly could be.

And A.K. Dewdney obviously has a bunch of books which could be used to inspire
young programmers. _The Armchair Universe_ , or _The Magic Machine_ and
similar launched many programmers, with "Core War", "Wator", "Bugs", etc

------
jferge
These are all way too hard for an average 11 year old...

~~~
timthorn
I doubt it very much. Children have an amazing capacity to learn and are
usually constrained by adults thinking that kids can't cope with more than
simple challenges.

~~~
sametmax
Some of those are even to hard for some adults I teach to. One of the most
important thing in pedagogy is to never mix several notions in the same theme.
E.G: making exercices involving maths.

------
ansjun
Slush Smackdown is also a fun way for children (not maybe for the youngest
children) to learn to code. It is not in Python though. Basically you code
your wrestling moves in Javascript and begin fighting against other people's
code [http://slushsmackdown.com/](http://slushsmackdown.com/)

------
tsumnia
I remember growing up wanting to build AOL chatroom bots, nothing like Eliza,
but trivia or combat bots - maybe around the age of 11-12. Though a bit dated,
an IRC trivia bot might be a fun exercise for them.

Or a text-based adventure to teach arrays. They build the map, then move
through it in the same manner.

------
arsalanb
The title kind of assumes all kids are amateurs. I feel age has nothing to do
with programming prowess. I may sound like I'm nitpicking but it should be
"Python Exercises for Beginners".

These exercises can be too tough for a 50 year old beginner, and a 15 year old
can breeze through them.

------
timwaagh
congratulations on having a very smart kid.

------
justifier
it's my opinion that the future of programming education will be compulsory
and simply folded into mathematics education

python exercises for kids? their math homework

------
brickmort
"You're gonna go far, kid"

