“Mom, don’t distract me. I'm learning Python!

what-again.jpeg

What? Again?

There really aren't enough good books on Python, why another one?

Hello! Perhaps you are a parent or teacher who wants to help kids learn to code.

I'll tell you about how and why I wrote a book for children on learning Python.

oblojka1

Mom, don't distract me. I'm learning Python!

Background

About ten years ago I already wrote the first book for children on programming.

It can still be found and downloaded for free.
On request “Yasha learns to program pdf” contains both the book and the history of its creation.

yasha2

Yasha learns to program, 2013

So that I could immediately work with graphics, but without any complications, I used Processing:

Processing is a well-known graphics library for Java.

It is quite popular in Western schools and colleges.
Great for kids and beginners.

Simple codedrawing a background of circles for the cover:

void setup() {
    size(400, 700);
}

void draw() {
    fill(random(255), random(255), random(255), random(255));
    ellipse(random(width), random(height), 50, 50);
}

Why Yasha? Jacob Fine? Not really. Just Yasha.

The book remained in samizdat, I communicated with publishers, but did not bring it to print.

And here it is February 22, 2022…

…no, not what you thought.

On February 22, the BHV publishing house got in touch and offered to work on it and publish it.

“Hello, Igor! You haven't lost interest in the idea paper book for children?

– Publisher

Many memory water has flown under the bridge for 9 years. Teaching, entrepreneurship, burnout, even diabetes.

And I thought and thought and agreed. Great, I’ll close the gestalt. And after so many years of non-stop teaching, the material would have been presented differently.

But in fact, it was just a beautiful number: 22022022
“Oui,” for those who fumble around in Morse (..- ..- ..)

Oui, we're rewriting everything, so no one will give you money

“But you need to choose a different language,” said the publisher.
According to book sales statistics, Java is no longer so popular.

But Python was just right.
Number one according to some reports.

tiobe1

Selecting a language. Scratch and Python are super popular nowaccording to Scratch, we have books by Golikov and Vinnitsky.

– Publisher

Well, yes, no big deal, let's convert everything from Java to Python. Business.

What did you rewrite?

TL;DR There was no talk of writing a completely new book. We just wanted to upgrade the old one. As a result, we got everything new: a new structure, projects, tasks, theory, programming language…

All that remains is the foundation – the Processing graphic library, adapted for Python as the p5py module.

Too convenient, from my point of view, for beginners. The experience of conducting courses over the previous ten years only confirmed that it is easy to get started “on schedule”.

p5js

Her JavaScript fork has 21 thousand stars on GitHub – an excellent objective indicator that complements my subjective opinion as a teacher.

The book should be for children to study independently, without parental involvement.

The publisher announced the goal.

This is a very important difference from circle classes: child + book, no teacher nearby.

– Publisher

OK. How can parental involvement be minimized?

So much so that you don’t even have to do any setup or installation?

Online IDE to the rescue

IDE – Integrated Development Environment, integrated development environment. Where they write code, launch and do all sorts of cool things. In our case, it would be more correct to call it simply a sandbox, due to the minimum number of functions.

I decided to make sure that one browser was enough to start.

We open the browser, and everything is ready there. We write the code, run it, look at the result, correct it, save it.

No settings. Everything works right away. What you need for completely independent learning.

I already had an online development environment for Processing, and there were many alternatives online. One openprocessing.org what is it worth?

But this was not the case for Python (so that Python + p5py would be online).

So go ahead and adapt the IDE.

For tech-savvy readers. Analysis of the stack and solutions is a separate topic. Let me briefly write that Brython is used to run Python code directly in the browser (with intermediate compilation in JavaScript).

Simple codewhich draws the circle background for the cover, now in Python with the p5py module:

from p5py import *
run()

size(375, display_height)

def draw():
    fill(rand(255), rand(255), rand(255), rand(255))
    ellipse(rand(width), rand(height), 50, 50)

Mobile-first

– Well, since it’s a new book, then the approach should be new, but proven. And in a foreign trend, I thought.

What if…

– No, no, no, nonsense!

Well, still, what if…

…improve accessibility for readers by making it possible to browse not just in a browser, but also on a smartphone? – I thought.

For tech-savvy readers. We change Monaco to CodeMirror v6 in the online-IDE, because the first one does not support writing code on a mobile phone.

Gaa-a-ala, QR code!

Well, since everything is so fashionable, mobile and browser-based, how can we make the most of these opportunities?

– What if…
– No, no, no, that’s nonsense!
– Well, but still…

Since the development environment is adapted for mobile devices, and all code examples are stored online, then you can refer to them from the book simply by using a QR code, I thought.

s2-2-432

And he made it so that all you had to do was point your phone at any QR code in the book, and the code editor on your smartphone would immediately open, and the child could immediately start (or continue) programming.

And this is especially useful in tasks like “continue the code.”

After all, now you don’t even need to download or search for anything. You simply entered the address into your browser or scanned the QR code with your phone and received a working version of the program. You can continue to refine it according to instructions.

What if an error occurs and you can’t fix it? The same thing – I read the QR code with my phone and checked the solution.

(~Save~) Launch and save

Why did you adapt your old online code editor?

Firstly, there were no alternatives. Well, there was no online Python with support for the p5 graphics library.

And secondly, I really wanted minimalism.

Everything should be as simple as possible for beginners. When they grow up, they will have time to become familiar with the difficulties.

Guys, don't open this topic. You are young, playful, everything is easy for you. That's not it.

Still, a book for self-study – so that parents don’t have to ask which of the 100 buttons to press now.

savecode1

Just two buttons

Therefore, we only had two buttons in the code editor: Запустить And Сохранить.

It was only later that I experimentally added buttons with an AI assistant to the children’s circle to further increase independent learning.

The title must be original

And illustrate what this book is for independent training,” said the Publisher.

We went through a dozen names.

We settled on the one that emphasizes this “independence”:

– Mom, don’t distract me. I'm learning Python.

Cover

I generated it in Midjourney

on a paid plan to preserve copyright

oblojka1

Dev

But the artist of the publishing house later redrew it a little based on it to his taste.

oblojka1

Prod

The idea was that right in the store you could read the QR code from the cover and open the first program on your phone.

Content

I decided to do it in the form of dialogues.

It's easier to read this way.

There is a main character – a boy, and there are many secondary characters who communicate with him and talk about this and that.

For example, if we are writing a game about a flying saucer, then who will be the hero for the dialogue?

That's right, UFO.

103p

UFO flies here and there

Layout

I typed it up in the banal Pages on a MacBook.
Yes, not a very suitable tool, it seems.

But, surprisingly, almost all of my layout went into production without changes.

Easy start

According to Scratch… there are the smallest children from the first pages they start making games, cartoons and jokes.

– Publisher

Here we are too.

Instead of just displaying the text “Hello, World!” – Let's immediately dive into the graphics.

From the very first steps we learn to work with a coordinate grid, change the colors, sizes and positions of objects. We draw our first shapes: triangles, squares, circles.
This helps you better understand the syntax and make fewer mistakes in advanced topics.

Then we move on to more complex tasks. For example, let's create a game where you need to run after a carrot or control a character who catches bones.
Along the way we study variables, cycles and conditions.

Let's do it again, Igor, it's all too complicated

Said the Publisher on June 22.

Everything would have been fine, but the book was already ready, compiled, laid out by the author, and projects had been developed.

#project Dog and Bone – Very long. I didn't have the patience to read to the end. And Aijen children generally cannot concentrate for long periods of time. I suggest breaking it down into short projects.

– Publisher

– How is this new? — At first I was a little shocked…

But I sighed, exhaled, thought, thought again and started again, because…

The projects turned out really cool, but heavy. Twenty pages per project is a lot. For children with modern clip thinking.

So yes, I sat down in the summer to redo everything. Just before the deadline for submitting the manuscript.

colors1

Each step has its own background color

I divided all projects into mini-projects, mini-steps.

2-4 pages each.

Each step is highlighted with its own background color and is a completely complete solution. I went through it, I did it, I enjoyed it.

Storm in terminology. Pixel/pixels or pixel/pixels?

How do you usually speak?

In the process of writing the book, we raised such a storm about how to spell this word correctly. The entire publishing house was on edge.

It was important to me how children now speak and are most often encountered in the media. The book is all innovative, and the old style would be very different. This was important for me.

As a result:
I propose to agree with [авторским] version of “pixel/pixels”, which corresponds to both the rules of the Russian language and modern trends.
Regardless of how we used to write in our books.

– Publisher

pixelei1

pixelei1

As a result, they left the author’s “pixels” and, as I understand it, changed the publishing rules to comply with modern terminology.

This is how you write a book and improve the industry. It happens.

Support from where you didn't expect it

At some point I was already tired of working.

And then…

…eight years after I wrote the previous book, I receive this warm review in my email.

July 29, 2022 at 4:48 pm

Hello, Igor! My name is Bogdan, and I hope that the addresses to which I write are still relevant, and sooner or later you will read this letter.

Once upon a time, when I was a 9-10 year old child, I came across a site that published a tutorial on HTML and CSS. For me, this was my first acquaintance with how a computer works behind the scenes, and I showed off to my grandmother and mother what a great programmer I am now, and how I can write websites myself. Back then, I didn’t yet understand that HTML was not really a programming language, but I forever fell in love with code and the magic of creating something of my own.

And then, when I was about 12 years old, I came across your book “Yasha Learns to Program,” and devoured it all over three days, reading at night, programming from this book during the day.

And then I realized that I wanted to be a programmer.

And now, 8 years later, I am writing to you, already a third-year student at MIPT.

I want to say thank you to Intiku, Yasha, Big and Small Gigabytitsa and, of course, you for making me fall in love with programming.

Largely thanks to you and your work, I study where I study and learn what I teach. And I have never regretted it yet. Good luck to you!

With respect and deep gratitude,
Bochkarev Bogdan

Thank you, Bogdan, it was on time!

Project-oriented approach. First “why?”, and then “how?”

Theory without practice is of little interest to anyone, right? Children especially become bored if they do not see how theory works in practice and why it is needed. By the time you get to practice, you’ve already forgotten what they talked about.

So I went a different route and used a project-based teaching method.

Children first face a real problem, and then learn the theory that will help solve it. This makes it more interesting for them, because they immediately see the result.

For example, it is necessary that a UFO, having flown from left to right to the wall, will again end up at the beginning. And again he attacked the player.

Here's a great motivation to learn conditionals:

If flew in That return the UFO to the beginning of the screen.

The dog and bone game is also a good example. We are faced with a problem: how do you know when a dog has caught a bone? And this is where we learn how to compare variables and calculate distance.

If the distance between the dog and the bone is less than 10, That We believe that the dog caught the bone and chewed it off. Af-af…

Theory appears precisely when it is needed to solve a problem.
So learning becomes fun and practical – theory is always in the context of a real problem.

Games: what it was all about

play1

Two big games and a dozen small projects

For example, we create our own version of the game Flappy Birdonly instead of a bird we have a hare that jumps over the bushes.

There are also more difficult tasks, such as a game about aliens that attack the earth and you need to shoot them down with lightning. We use standard gaming techniques, such as limiting the amount of energy for lightning and limiting the player’s lives.

What about the errors?

Everyone always has them.

At the end of each exercise we have a QR code. You scan it and immediately see the ready-made solution. You can compare it with what you got.

errors1

Let's get acquainted with common mistakes in advance

And, of course, we constantly analyze common mistakes. Oh, those gaps. Not in education. And in Python, that is, indentation.

You put not four, but three – and that’s it. We constantly repeat this so that when a child encounters an error, he already knows how to correct it in most cases.

Desktop

At the end there is one section about programming in standard Python on the desktop.

In VS Code, yes.

Already without any browsers.

vscode1

Python in VS Code

To make the transition from our cozy sandbox with two buttons to the world of big programming comfortable.

Why didn't I start with this? Why is the chapter about desktop Python at the very end?
The p5 library for desktop Python is sparse in some important places compared to the one used in the browser.

  1. For example, emoji cannot be displayed. And all the projects in the book are based on emojis – so that there is a variety of pictures, and you don’t have to learn a graphic editor at this first stage. And everyone is familiar with emojis from chats.

  2. Requires you to always use setup(). And it was important for me, at the very first iterations, not to introduce new concepts ahead of time: a) indentations in blocks and the resulting errors in case of non-compliance, b) the blocks themselves, their explanation and designation. We'll study this later. And it’s important to start in such a way that everything is clear and as simple as possible at the very first step. But maybe I’ll add this library (p5) in the background, then the browser will become completely optional.

All or nothing?

Of course, the book does not cover every aspect of Python.
This is rather the first step – an opportunity to interest a child in programming.

Write your first games from scratch.

If he likes it, he can continue studying on his own or with your help.

Let's sum it up

What problems did I try to solve in the book?

  1. Setting up your environment. Often children (and adults) get lost in the process of installing and configuring programs. It can be difficult and time-consuming, but you want to start programming right away.

  2. Autonomous training. It would be great if children could learn on their own, without the constant help of their parents. In my book I tried to make this a reality.

  3. Difficulties in teaching programming to children. It’s great if learning can be organized as a game, with visual projects. It's easier and more interesting for the child.

  4. Bridge between Scratch and adult programming. For those who have outgrown Scratch, but are not yet ready to dive into complex libraries like Pygame, my book is just right. It is a kind of bridge between Scratch and professional programming.

  5. Easy start. In the book, I use emoticons for games instead of complex pictures. This makes it easier for children to get started.

How to start?

The child completed the entire book in a month. I figured it all out on my own without help.

– Alena M. June 30, 2024

What now? If you are interested, you can look at a free sample of the book “Mom, Don’t Distract. I'm learning Python! on any site.

There are sales periodically.

Try to evaluate whether it is suitable for your child. If you like it and want your child to start learning programming, try it – he will probably be interested in the book.

An entire book, the author's many months of work with complete immersion, will most likely be even cheaper than one lesson with a teacher. Why not try it.

In addition, the author is nearby, in which case you can write to me dog igor dot kg.

You can also download the previous book for free “Yasha is learning to program”.

Alternatively, you can go into the online development environment, run a simple game, and even try changing something in the code. This will give you a feeling of how easy and fun it is.

The Telegram channel remains in a completely rudimentary state, but you can stop by for a visit: https://t.me/p4kids

The spirit of innovation, experimentation, inspiration and tolerance for mistakes is what I wanted to convey to my readers with this book.

It was interesting for me to write it, invent it, endlessly improve and adapt it. Develop projects and rewrite them again. Someday I'll tell you the rest of the stories.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *