A Universe in One Line of Code with 10 PRINT
This has me reflecting on how I learned to program, compared to how people learn to program today.<p>I learned to program using BASIC when I was between 5 and 10 years old. My dad was a software engineer at DEC, and he had a kit computer in our basement that he let us play with once in a while. My first program was a number-guessing game, and it went something like this:<p><pre><code>    10  NUMBER = 23
    20  PRINT &quot;I&#x27;m thinking of a number.&quot;
    30  INPUT &quot;Make a guess: &quot; $GUESS
    40  IF GUESS &lt; NUMBER THEN
    50    PRINT &quot;Too low!&quot;
    60    GOTO 30
    70  ELSEIF GUESS &gt; NUMBER THEN
    80    PRINT &quot;Too high!&quot;
    90    GOTO 30
    100 PRINT &quot;You got it!&quot;
</code></pre>
That was pretty straightforward, because everything about it was linear except for the GOTOs. You can think about each step with very little planning, and when you need a break in program flow you can use a GOTO. It also means when teaching, you can introduce each new concept as the need arises: store a value, print a statement, prompt for input, check a condition, and go back to a previous statement.<p>Let&#x27;s see the same program in Python:<p><pre><code>    number = 23
    print(&quot;I&#x27;m thinking of a number.&quot;)

    guess = 0
    while guess != number:
        guess = input(&quot;Make a guess: &quot;)
        guess = int(guess)
        if guess &lt; number:
            print(&quot;Too low!&quot;)
        elif guess &gt; number:
            print(&quot;Too high!&quot;)
        else:
            print(&quot;You got it!&quot;)
</code></pre>
The overall program logic isn&#x27;t much different when you read the code. But to write this code, you need to know a number of things in advance. You need to know how you&#x27;re going to approach the problem. You need to know what a loop is, and specifically what a while loop is. Conceptually, especially for a young person, a while loop is much more abstract than a GOTO statement.<p>I am happy that people get to learn a language like Python as their first language today. They can do much more interesting things, in a shorter amount of time, than they could in basic 40 years ago. But the very first programs people write seem fundamentally different, and that&#x27;s not a bad thing.