Hello, Dear Reader!

In the beginning, the Earth was without form, and void. But the Sun shone upon the sleeping Earth and deep inside the brittle crust. Massive forces waited to be unleashed. Then programmers appeared with the Python Programming Language.

The knowledge of programming languages, the ability to write a program and make device work as you need are highly required and may bring you considerable income. The most successful people on our planet are often associated with the IT industry. Remember the success story of Steve Jobs, Bill Gates, Mark Zuckerberg. These names are well-known all over the world.

The age of technologies implies that everyone knows how to use devices, each one has developed the skill of "pressing buttons" and getting the result. But, as my teacher said, driving a car as a driver is one thing, but driving a car as a mechanic is completely different. Understanding of the process opens new horizons and gives much more confidence!

What is the purpose of technical devices? The answer is pretty obvious: devices make our challenging living easier. They entertain us, carry out routine work, collect data and information, monitor our safety and vacuum, finally!

However, what happens when you press the lever before seeing the result? What occurs when the signal is received from the fuel level sensor in a fuel tank before the light flashes on the control panel of your car? What takes place when you tap the icon on the smartphone screen before launching the caller's call animation?

Right! It's a program!. The program that receives data from devices, performs certain actions with them, and makes the result. Your smartphone is constantly waiting for clicking on the contacts' icon. As soon as you touch it, the smartphone program starts a whole chain of actions: at least, it receives your contacts, arranges them properly and displays them on the screen. And all in order for you to choose the right person, call, and enjoy the conversation or quarrel badly, which also happens often.

The entire action of the "Contacts" program can be safely summarized and named as a data processing. Any program on your computer, smartphone, TV or even on the smart refrigerator performs only one function - data processing.

One more time - each program processes data.

And... and nothing else, I swear, that's how it goes.

Data processing. Remember this expression. It's Hakuna Matata of programming, number-one prayer of coders worldwide, developer's zen, polar star on the way of writing code.

No more, no less. Just data processing. Who teaches device to process data? Easy! It's a programmer that writes code in a special language. The program will do everything that is laid in it by the programmer, become a demigod who creates a new digital world, mother and father of the Result that we'll see on the screen of a monitor, smartphone, or bicycle computer. Or on the dashboard of our small light-weight aircraft, tearing flawless silence of the sky with bee buzzing propellers.


Communication with the users of the application in Telegram chat revealed another problem: there is no sources of system information about programming. What do I mean saying "system information"?

One summer it occurred to me to replace the metal spring of the air rifle with a gas spring. I had heard that it reduced recoil and made it more comfortable to shoot. One fine day my friend and I gathered in the garage, took out the old spring from the rifle and began to push the new one.

And here the problem appeared: so that the gas spring fit into the grooves and was fixed, it was necessary to make a huge effort, for which the two of us simply did not have enough energy. We twiddled the rifle in all ways, propped it up with a piece of wood, tried to hammer a spring (fools!)... Like in the fable of Ivan Krylov "The Monkey and the Glasses".

After two hours of efforts, we resigned ourselves: we couldn't put the gas spring in place. We needed some kind of machine that looks like a huge vice to solve the problem.

"And suddenly the inventor appeared..." (it will be said more about this wonderful phrase in the chapter "Tactical Ploy" of the "Learn to Count" game). Another friend of mine, a technically developed person who dealt with cars and everything connected with them all his life, drove up to the garage.

He, as befits true friends, laughed, used some irony, trolled, made us fools, having said that "sticking the gas spring is easier than taking candy from a baby", and... he just sticked it!

My friend built a simple construction by placing a rifle with a protruding gas spring between a log, a small piece of iron and a garage doorway. He pressed a shovel handle against the doorway, the other end of which pretty firmly rested against the protruding part of the gas spring. Then with one hand, completely without strain, he slightly covered the garage door and ta-dah! The force was transferred to the handle, the handle "pushed" the spring inside the rifle, where it clicked! Bingo!

What happened? After all, the garage remained a garage, all pieces of iron, wood, the shovel handle, the air rifle and the gas spring remained the same. But the man appeared who could put everything together, took into account every parameter, who could figure out that it's necessary to apply the principle of leverage with the help of scattered objects.

My friend and I couldn't figure out. Although everything was literally underfoot: bend down and pick it up.

The systems approach is step-by-step increasing complexity of material. It is a principle on which each subsequent link is based on the previous one. It is creation a strong connection between theoretical and practical knowledge, development of the skill to "see the path" to solving the problem on the basis of available tools and data.

What is this long and weird reasoning for? It is in our power to tighten the nut or to drive a nail. It might look messy and unprofessional, but we are able to do it. We know that the house is built of bricks, we also know that if you throw seeds into the ground, something will grow out of them.

But we can’t build a house, assemble a car, grow a field of wheat. Why? Because our knowledge is not systemic. It is fragmentary. We don't see the whole picture, but only a small part of it.

The reason I wrote this material is as follows: there are a lot of instructions, videos, discussions on the Internet about how programming languages ​​work and how to use print() to display something on the screen.

This information is fragmentary, it, like the knowledge "the house consists of a brick", will not give us anything. We will not be able to create something truly useful after studying the action of each command of the language. Fragmented thinking is a plague of modern society. We learn something, know the terminology, but we don't know how it works from the inside. We can't use the knowledge in practice.

However, such knowledge makes a person believe that he is something of a scientist himself. He sits in an old rocking chair, drinks coffee, and understands: "the seeds sprout". And immediately he becomes so important in his own eyes, and a tear of pride for his own wisdom rolls down his cheek... Foolish? Yes.

Therefore, the main task is not to study and describe the commands of the language (although we can't just ignore them, we'll learn them as well), but to teach to use these commands and see the result. My technically developed friend had seen that solution of the problem with a gas spring is "blowin' in the wind". I want to teach you the same: to know how to create the structures from the commands that will help you to achieve the target.


To begin with, it's all for you, comrades!

P.S. Oh yes, I love games. In honor of Leroy Jenkins, amen.

The only obstacle that may arise on your way is laziness and unwillingness to follow the suggested instructions and recommendations.

For almost two decades, I have been teaching computer science and focusing on programming. The material is designed for everyone who is interested in it or has to master programming immediately. For example, if you have a desire to change the sphere of activity and you don't know where to start - start here. Right here, right now. Do it!

Presented games are as easy as a pie. I don't seek to write extremely difficult algorithms, work with huge amounts of data, or make software for automated parsing, no.

The greatest things are the simplest. A journey of a thousand miles begins with a single step. To add three-digit numbers, you must first learn how to work with numbers. Our whole world, after all, consists of the simplest particles. They combine and connect with each other, creating such marvelous stuff as fried meat, soft beds, and fast cars.

We will go the same way. Why should we be contrary to nature? After dealing with simple, we will move to complex. It's planned to write a few more parts of the application in the future ... but hmmm, let's change the subject.

Nevertheless, don't be confused by the apparent simplicity of ideas! To put them into practice, you need to know a lot, be able to link, process, store, display, determine what the user needs to see and what should remain in the mosaic of the program code.

Getting a practical result, seeing the work product right in front of your eyes are undeniable benefits of game writing.

By the way, one of the main problems of programming at school and at university is giving a pure theory without practical notes. We learn algorithms separately from using them. We find the minimum and maximum numbers... For what? LCM of numbers - for what?

So what if I say that the algorithms of finding the maximum and minimum numbers are important in navigation systems and artificial intelligence. Hello, but LCM is responsible for zoom in Google Maps. Moreover, 3D technology can't exist without these algorithms.

So what if I show how it works? Applied programming! What is the point of frying potatoes if you won't taste or sell it? What for to carry glasses in your pocket if you can use them as intended? Theory without practice is dead, practice without theory is blind (I couldn't find out the authorship of this quote because the high and mighty Internet gives different points of view, maybe you will be able to do it).

Therefore, dear reader, we will reinforce the theory with practice, and practice with theory!


Our primary task is to study how a computer processes data. Without any mess and hassle. There will be just basic math and basic logic, understandable for everyone who knows how to insert a key into a keyhole.

The complexity of the tasks is low; the demonstration of the capabilities of the computer and programming language is high.

Python is selected for 3 reasons:


I hope the word "contests" has attracted your attention. However, to my own amazement, it is not a contest here, it is about contests.

The point is that the profession of a programmer doesn't have any reasonable ending. You can't say, "Uh, I'm a programmer." A programmer means motion. A programmer means to update knowledge constantly, to accumulate experience. The world is developing fast enough, and good programmers should be always at the crest of a wave, keep up with the demands of the time.

Programming contests may be very useful for such purposes. Fortunately, now there are a lot of them - from top hackathons, Google/Microsoft fests to quite affordable local events.

Seek, and you'll find. Are you studying in school? Ask your Computer Science teacher about competitions you can take part in, the teacher most likely will help you with enthusiasm. Are you working? Look for contests from different educational projects and IT-corporations. "Programming contest" typed in a search bar will give many diverse options.

Just be bolder, join in, and try your best. In the first stage, it is not so important whether you win or lose. The main thing is to go all the way. Even if your work recalls a toad suffering from sleep disorder, go to the end anyway. Are you not sure in your abilities? Go all the way until you pass the program! Not results matter but the process. And the confidence will grow with each passed competition. Haven't entered into prizes? Pff, never mind, you're just studying!

The objective of participation in contests is not to get more and cheaper but to join the community of programmers, evaluate problems, evaluate your knowledge at the current moment. To measure your abilities, find the "gaps in experience" and close them successfully. Competitions? Participate!

I went out from All-Russia hackathon "Цифровой прорыв" ("Digital Breakout") in the southern IT-hub with a win in August 2020. But at the beginning of the competition, I had known nothing about what would be required to do, how it would look and what was expected of me. Considering that about a thousand programmers from the South of Russia took part in the hackathon, I felt a little uneasy.

As a result, three sleepless days spent at the computer became the most intense in the entire summer of 2020. I experienced a range of emotions: disappointment, inspiration, fear, admiration, hatred, recognition, friendship...

Lots of people: professional programmers, non-professional programmers, just programmers, and not programmers at all - were creating the atmosphere that reflected the modern progressive world. Cryptographic protection, artificial intelligence, blockchain, biometrics... It's a pity that everything ended so quickly.

Nowadays, it is important to know how to present yourself, I'm not great in it, to tell the truth. Perhaps, I should attach the diploma (Plays hard to get (actually not). You believe in my skill to write programs, right?).

At the hackathon, I met and worked in a team with an excellent specialist - Andrey Donets from Krasnodar. He invented PHP, database and MySQL is awesome back-end (server-side coding) developer with non-trivial thinking and interesting solutions. And even just talk, develop any program in such environment is a pleasure for me.

Contests provide opportunities to broaden your horizons, improve your skills, extend relations. You will meet wonderful people there. It can be those who will openly stress you, and those with whom you will continue to interact and communicate, share ideas and find solutions. The main thing is that that you only acquire something at such competitions (experience, knowledge, relationships).

Programming in the cosiness and comfort of your home won't let you achieve full potential. Go public!

Just remember - competitions are cool, useful, and necessary. As soon as you feel the desire, participate without further delay. I wish you wise solutions and affordable assignments!


Once I was watching the work of the famous (in my town) artist. He agreed to show the drawing process, looked at the blank sheet for about five minutes, as if there were some mysterious signs; then, with clear and sharp movements, like a surgeon, he drew some lines and moved away.

It didn't look good, but I managed to distinguish a riverbank, trees on that side, and, for some reason, a small beach umbrella in the foreground... Pencil lines formed a chaotic web in which my brain independently determined familiar forms.

Then again the pencil battle with the paper took place, the lines became sharper and brighter. What I first had taken for a beach umbrella, turned out to be the roof of a building with curious architecture. Honestly, half an hour later I became tired of watching and left, having said goodbye. As I suppose, after that an eraser, paints, may be even some special art tools played their roles.

Eventually, I saw this picture in the final version: there was night, moonlight on the water, a dark forest with a group of fireflies, and a cute house on "that" side, through a lighted window of which you can see an open and, sorry for that, cozy as hell bed!

The structure of this coursebook partly repeats the work of the artist. First chapter contains language basics - elements that we will use in game writing. The following sections are devoted to creating games according to the principle of the artist's work: we initially draw a framework, and then we switch on details.

Do you remember "Hellraiser"? One character is reborn from the skeleton. Similarly, things go with games: we start from the skeleton, and then work on it. Therefore, I recommend reading the material sequentially, delving into it and putting it into practice.

No, you can't just copy code from the app. No way. My position has been unchanged and it remains the same: if you want to learn, then rewrite. No copy-paste!

The material is presented sequentially, but writing the code is more fragmented. As for a programmer, he follows the pattern: the first is a framework, next are details. Likewise, I write this coursebook basics are first, then we go further and wider. After all, we receive something complete and systematic.

Yes, the application contains advertising. It is full-page and will be shown from time to time. Please, treat with understanding. If you want to cut off any ads, then turn off the Internet on your device...or you can support the project. Anyway, you are the one who decides, I just inform :)

While advancing, you will meet some questions. The answers to them are presented right here, in the coursebook (see the example below). Answer and check at once. Compare and analyze.

Click here to find the answer

All your base are belong to us.


All used images were created by the author or downloaded. Downloaded materials have an open license for commercial use.

All text materials except for the program code belong to the author. Reprinting or publication without explicit written permission is prohibited.

Program code belongs to you. You can type, distribute, modify it, use the applied algorithms and tricks; you can pass it off as your own without specifying the author. Do whatever you want with it!

The program code is highlighted in a special field, for example:

print("Hi, it's me, program code!") print("You can actually do with me anything!") When the inscription doesn't fit the size of the window, tap to scroll text right...or left.


Taking into account the wishes of the users of my another application, I added the progress markers:

Also, use menu to increase or decrease the font size and to disable "Continue Reading" (enabled by default) which allows to start reading from where you left off last time:

I am sure that innovations will facilitate the work with text.

Good luck!

Faithfully yours,
Viktor Trofimov
Danil Shentsov
April, 2020

© 2019-2024 Viktor Trofimov
© 2019-2024 Translation and adaptation by Danil Shentsov
[ Top page ]