An Overview of Python for People Who Are Not Programmers

Python

Welcome to the first installment of this series on Python for non-programmers.

If you are reading this, you have undoubtedly grown interested in programming and are trying to figure out where to begin. I am pleased to inform you. One of the greatest languages to begin your adventure with is Python. Why? We will discuss that in a moment. Let us first explore the precise nature and capabilities of this language.

One such high-level, general-purpose programming language is called Python. Let us dissect that definition.

First of all, what is a high-level language? Let us consider this:

The bottom-mounted computer gear is only capable of deciphering “machine language.” Given its low level of operation and intimate relationship to hardware, machine language, also known as machine code, is considered a low-level language.

As you move away from the base level, languages grow more sophisticated because they are disconnected from the physical world. The technological details of the computer are invisible to and unusable by high-level languages. It would be much harder to use them if they did.

High-level languages:

  • Are programmer-friendly and easier to understand.
  • Are less memory efficient.
  • Are easier to debug.
  • Are relatively easy to maintain.
  • Are portable (so they can run on any supporting platform)
  • Require a compiler or interpreter.
  • Are widely used.

So Python being a high-level language already gives it a head start on user-friendliness.

Our next definition is general purpose. A general-purpose language is a computer language that is used to solve a wide variety of problems. In other words, you can use a general-purpose language for many things.

Put those two things together and Python is a programming language that can be easily used for several purposes. But Python isn’t just easy to use because it’s a high-level language.

What Makes Python so Easy to Use?

One of the main reasons why Python is so easy to use is because it reads almost like the English language. Python has a very clear and simple-to-understand syntax that is used for web developers, desktop developers, game developers, data scientists, and more. With Python so widely-used, it has a very large community, so help is never far away.

So, Python is easy to read, used everywhere, and has a vast community for support. In fact, of all the programming languages, Python is almost always considered the easiest to learn.

The picture is becoming clearer and clearer.

With all of that said, let’s introduce ourselves to Python.

Interpreted Language

The fact that Python is an interpreted language is another feature that sets it different from many other languages. This implies that you can create and run programs in Python without the requirement for a compiler. That implies that Python installation is also required. It would not do you any good if you produced the hello-newstack.py file without having Python installed. On the other hand, you could make the file, add the code, and run it (without needing to build it first) if you had Python installed.

Let’s walk through this very simple example.

Hello, New Stack!

The Hello, World! example is one of the most popular examples (for almost any programming language). This straightforward program prints a single line of text to the terminal. Python uses a concept known as a function, which is a collection of instructions that have been previously assembled to accomplish a certain goal, to do that. This implies that not everything needs to be created by the coder.

Allow me to put it in simpler terms. Take a Lego, please. A set of Legos comes with a number of bricks that you can use to construct various objects. However, that kit also includes unique parts that can be utilized to construct certain objects. For instance, you may easily construct Lego people with the heads, hands, torsos, limbs, and legs that are included. If you had to construct those individuals with the Lego bricks that were given, just think of how much longer it would take. It would not only be more difficult, but the people would also appear less like humans and more like blocky robots.

Consider those unique “human bits” to be functions. As functions, you might also think about certain parts that simplify the construction of vehicles, aircraft, rockets, or the International Space Station.

Let us go back to our example.

The print() method is all that is required for the Hello, World application. It instructs the interpreter to print out whatever is contained between the (). Thus, using our Hello, New Stack example, the following is how that function might be used:

print('Hello, New Stack!')

That is a Python code line. More importantly, you only need that one line of Python code to complete the Hello, World example. Since competent coders, of course, also document their code, we would begin it with something like this rather than just that one line:

1#Print out the text “Hello, New Stack!”.


Let us combine those. Launch a terminal window and use the following command to create a new file:

nano hello-newstack.py

Put the following into that file:

12#Print out the text “Hello, New Stack!”.print(‘Hello, New Stack!’)

Using the keyboard shortcut [Ctrl]+[x], save and exit the file.

Recall that without Python installed, a Python file (one that ends in.py) is useless. Come with me while we install it. I will use Ubuntu Linux 20.04 to show. Giving the command again at the terminal window:

sudo apt-get install python3 -y

With the following command, we can now launch our newly created Python application:

python3 hello-newstack.py

The output of the command will simply print Hello, New Stack! (Figure 1).

Figure 1: Our new Python application successfully ran!

Congratulations! You have successfully used Python for the first time without any prior programming experience. We will learn a little bit more about the language and how to make a somewhat more complex application in the next installment of this series.

Leave a Reply

Your email address will not be published. Required fields are marked *