How to Hello World

Photo by Dean Pugh on Unsplash

How to Hello World

After teaching kids for a while, I've been a little troubled on what is the best way to teach them hello world in Python without shortcutting on some fundamentals.

The common way is:

print("hello world")

Now, I would like to suggest the following instead (please stay with me):

output = "hello world"
print(output)

I noticed that for the most part it does not click that print() is a function that takes in something (a string) and then prints this out on the screen. And they get to struggle a little down the line when we introduce other forms of print like print("my name is " + name) or even worse, "magical" ones like, print("my name is", age).

I submit that it is important to separate these concepts so that from the get-go, they know that:

  1. We have magical things (abstractions, of course no need to start dropping big names like these ones) called functions. And this specifically are in-built functions, though at a later stage we will write our own.

  2. A function is called by adding the () on to the name of the function. In between the parentheses, we put things that the function takes. Then the function will do something.

  3. In our case, that function is print and it is called by taking a string output which has a value of "hello world". Shortly after, in a later lesson, we will cover in detail what really these things are (variables).

What I have learnt to do is to make sure that, in any given lesson, I only introduce 3 new terms (jargon) at most. For instance in this hello world example, we could introduce only these 3 jargons: function, variable, string. Actually these 3 are quite loaded, you can even try cut down if possible.

Lastly, it's very important for them to know that in between the " (string value), it can be anything. There's nothing special about "hello world", it's just tradition. Actually have them do multiple prints with various languages e.g. "jambo dunia", "habari zenu", "jambo bwana", "Bonjour le monde". They learn better with repetition.

Lastly, there is no really the best way of doing it, for some students, things click a few lessons down the line. It's very important to always go back and review from the beginning especially in light with the new details they have learnt. For instance after covering a lesson on functions, you could go back and dissect print("hello world") in detail now.

PS. Check here where I try to make a case with Chat GPT on this approach - https://chat.openai.com/share/9f53549f-858b-4224-8160-a5e87b37f0f0

__
You can check out our kids coding programme atlkc.code