I don’t like the typical beginner’s Hello World program in books and videos. They don’t do anything that resembles the power and the beauty of the programming language. When I learned BASIC in 1980 it was more thrilling than everything today.

10 print "Hello World!"
20 goto 10

Running that at least taught you that you can loop a command. Programming languages are more than just a bunch of syntactic statements to chug the computer along like a robot. The computer doesn’t understand a word in your script! The beauty of a programming language comes from knowing that the coder will want the simplest way to write thousands of lines of code that can be translated into the computer’s language. Then the computer’s language will have to sequence the instructions to make it run as efficient as possible. After considering the methods that fit both needs best, it’s knowing that how inefficient and how nerve-wracking it is for the coder to work with the imperfect language, that language is being used to design some of the best software in the world. And after all of that, all one gets for their program is:

print("Hello World.")

Here is an example of what I would consider using some of the strengths of Python as a first lesson. It would print Hello World, but instead of “World,” it would capture persons’ first names from a list and print the line for each name in the list. This shows the student some of Python’s strengths by using a list, capturing the first names and the items they possess, having all names in the list lower case only, displaying the names with the first letters capitalized, including their possessions in the messages, and displaying the same message with the exception of the first name and possession, all through a simple loop based on the number of items in the list. It doesn’t have to teach the student anything about lists or loops. It just shows how simply Python can do that from a few lines of code. When the student realizes that this code can be used to automate email distributions, that student may think about more ways to use that code as well. It feels like better learning.

ballteam = {'gary': 'ball', 'maria': 'bat', 'bob': 'glove', 'carol': 'bases', 'ted': 'helmet', 'alice': 'drinks'}
for key, value in ballteam.items():
    print(f"Hello {key.title()}! Please bring your {value}.")

Instead of one line, there are three. The result after running the tiny script makes all the difference.

Hello Gary! Please bring your ball.
Hello Maria! Please bring your bat.
Hello Bob! Please bring your glove.
Hello Carol! Please bring your bases.
Hello Ted! Please bring your helmet.
Hello Alice! Please bring your drinks.

A bright student will look at the list (called a Dictionary in Python) and notice the correlation between Gary and ball, Maria and bat, and so on.  They may gawk at the syntax if they’re not used to it, but it’s far better than reading old Assembly code. After a while, the coder will glance at the code and say, “Hey, that’s Python.”

The author/teacher can show the ‘print “Hello World!”‘ line, but then have the student type in the three lines of code, letting the students see their results. It’s likely that the first time coder will make a mistake typing in the code. Letting them make the mistake will help them understand the importance of correct syntax, especially indentation. Python uses indentation instead of braces for wrapping functions, loops, if/else statements, etc.

As a young adult, I used to see all the old home computers in the stores at Christmas time. A lot of times the monitors would be sitting there with a blinking cursor, doing nothing. I would write a few lines of code, run it, and let the computer look like it was actually doing something. A fancy animated message like, “Buy Me!” could possibly help sales. You’re welcome. One time at a Radio Shack, I came across one of their first PC-type computers. The monitor was stuck with something on it. I asked the clerk if he should change it. He said that someone reset the password and they can’t get into it. The danger of demonstration models.

The Apple II computer I bought in 1981 was the last of the hobby/hacker computers. The prevailing thought then must have been that everyone would want to write their own code. I did. But instead, everyone wanted to pay an arm and a leg for someone else to write the code. The cost of everything software at the time when the home computer was growing, kept many young people from making a bigger influence on the computer of today. We have lots of very talented coders, but only a comparatively few of them advanced everything to what we see today. Languages like Python, Perl and Java have always been free, but they weren’t around in the Eighties. I took a loan to purchase Microsoft C.

Microsoft and Apple wrote the book on home computer control. Apple at least uses a Unix core that allows some leeway, but not Microsoft. Linux allowed a poor boy like me to become a professional IT and software developer after learning at home. Today, even coding courses are free. Just go to YouTube! The quality of the instruction is top notch too. On another post, I’ll critique the different sites for learning code. I still want to have a computer that I can tell what to do.