More On Our Python Discovery

For those just joining us, I am on a quest to learn the Python programming language. Perhaps it will lead me to discover ways to create and program those fancy little widgets in WordPress, or create a page that extrapolates data from one source and presents it the way I want it to…or better yet, the way my clients want it to. Either way…fasten your seatbelts and get ready…here we go!

Well, I am picking up where I left off on my quest to discover Python (the programming language) after a fantastic message at church from Larry Gregg on the message of the cross. I liked the part where he spoke about the Greek word, “Teltelisti” which means, “Paid In Full,” or “It Is Finished” and that is what I am hoping to do with this Python discovery…teltelisti it. So without any further hesitation, here we go!

Apparently my first step is to learn how to think like a computer programmer. It looks as if I will be reading a book. Here is the link to the book on the OpenBook Project

Notes Along the way:

Okay I will be highlighting my notes in quotations along the way as we discover new things about Python where I pull from the source cited above. My personal notes will look like this:

[note]This is a personal note…any questions?[/note]

So it looks like we will be learning a high-level language as opposed to what? A low level language? Yep that is exactly what it is called. Apparently low level languages are used for computers to execute programs whereas high level languages must first be processed before they can be used by the computer. This is one of the drawbacks of using a high level language like Python.

It seems; however, that high-level languages are the most used in programing because the benefits, portability being one of them, far outweigh the drawbacks.

So…how do the high-level languages get processed so that the low-level executable programs can use them?

Okay…so there are two types of programs that process high-level languages into the computer usable low-level languages and they are called: Interpreters and compilers

[note]So…you might be thinking…Nick..Nick…Nick….I can read this for myself using the link you gave me above. Okay…you do that…don’t take my word for it. This is just a way for me to learn. I find that the more I handle information the better acquainted I am with it. In fact, my pastor once told me, “Nick if you want to learn something read about it, if you want to own it, teach it.” So in a round about way this is my way of teaching what I am learning, while I am learning.

Incidentally, I have two boys that are home-schooled (actually 5 kids that are all home-schooled) but I am going to be teaching my older boys Python too. I think it is good for them to learn the family business. Whether or not they use it is another story, but rather them have them simply playing video games, doesn’t it make sense that they should know how to create video games too? It all starts with programming….but I digress.[/note]

Interpreters and Compilers

All of this to say that there are processes by where the programming is turned into a usable format by the machines that are running it. That would be my assumption…but hey…I am not a programmer….YET…MUAHAHAHAHAHA!

Okay so we have the understanding of how high-level language is translated into a user-friendly low-level language, the next obvious question, to me anyways, is how does this work in Python?

Enter shell and script modes:

From this section I learned that all Python programs use the extension *.py* and the first line is what turns on the Python interpreter in say (Unix) and the next 3 lines are information from the interpreter.

[note]It is at this point that I wish I had spell check enabled…I never could spell interpreter correctly.[/note]

Also, I discovered that the command prompt looks like this *>>>* (asterisk not included)

So…if I wanted the interpreter to tell me the solution to the mathematical equation 1+1 it would look like this:

>>> print 1+1

The interpreter would do the mind blowing computation and give me the result:

2

[note]I am in over my head now…no turning back![/note]

Finally what I learned in this section is that using the Python shell mode is kind of like using a scratch pad to jot down notes. For longer more complicated things it is better to use script mode….which I am sure we will learn more about in subsequent sections.

So…now that my brain is about to explode…I am going to take a break. Join me next time as I discover the answer to the age old question: What is a program?

[note]By the time we finish this we should have earned an honorary degree in Computer Science huh?[/note]

[note]p.s. I am doing a spell check[/note]

Share

Recommended Posts

Leave a Reply

Your email address will not be published.