Python is my favorite programming language so I wanted to know, “Is Python a High-Level Language?”
I did a little bit of research to find out for myself and here is what I learned.
Is Python a High-Level Language?
Python is a very high-level programming language because its syntax so closely resembles the English language. Higher-level means it’s more readable to humans and less readable to computers. Likewise, Lower-level means less readable for humans and more readable for computers.
Because Python is high-level and therefore highly readable, it’s a great language to learn as a beginner. However, there are some drawbacks to being a high-level language. Read on to learn more.
High-Level and Low-Level Programming Languages
The first programming language was developed in 1689 by a German mathematician, logician, and philosopher named Gottfried Leibniz. The language he developed was the binary number system and it’s still the language that the vast majority of computers use to receive instructions and perform computations.
Other programming languages have been developed since then that makes it easier to write instructions for the computer. In 1947, Kathleen Booth invented Assembly Language which was a step up from writing binary code, but it was still incredibly time-consuming.
Shortly after, in the 1950s, various new computer programming languages were developed that made it easier to read and write. These are more readable known as high-level languages.
Eventually, in 1991, Python was developed by Guido van Rossum and it is perhaps the highest-level language in existence today as it’s one of the most readable. Let’s take a look at Python’s syntax for an example of its readability.
Example of Python High-Level Syntax (Python vs. English)
On weekdays, I wake up at 7:00 am. What if I wanted to set an alarm clock to help me wake up on time during the weekdays?
The logical conditional statement that determines whether or not the alarm clock sounds would look like: “If today is a weekday, then the alarm will chime at 7:00 am.”
This type of logical condition is very common in programming and is referred to as an if/then statement.
If this is true, then do this.
Since Python is such a high-level programming language, the Python syntax would look very similar to the logical conditional statement previously mentioned. Let’s translate that logical English statement into its equivalent Python function and we can then compare the two.
(Logical Statement in English)
If the day is Monday, Tuesday, Wednesday, Thursday, or Friday, the alarm clock will activate at 7:00 am. If it's the weekend then we'll sleep in.
(Logical Statement in Python)
def alarm(day):
if day == 'Monday':
print '7:00 am'
elif day == 'Tuesday':
print '7:00 am'
elif day == 'Wednesday':
print '7:00 am'
elif day == 'Thursday':
print '7:00 am'
elif day == 'Friday':
print '7:00 am'
else: print 'Weekends are for sleeping in!'
The Python code tests each weekday individually to determine whether the alarm clock will activate. Monday through Friday, the alarm will activate. Notice how similar the Python code is to the equivalent English statement.
This is why Python is considered to be high-level.
However, when you’re programming in Python you must remember that Python is also a case-sensitive language.
The Good and Bad of High-Level Programming Languages
You might be thinking “if Python is so readable and easy to use, isn’t it the best programming language?” The truth is that Python is a great platform-independent language and it’s my personal favorite but it’s certainly not perfect.
As a matter of fact, the same reason that Python is so readable is also the reason for one of Python’s biggest flaws:
Python is pretty slow. Generally speaking, the higher level of the programming language, the slower the execution times.
If you compare the speed of Python to a lower-level language such as C, you’ll find that the same program in C runs much quicker than that in Python. The reason is that all code must be translated into Machine code before the computer can process it.
Therefore, lower-level languages are easier and faster to translate into Machine code, giving them overall faster execution times.
With that said, there are certain things that can be done when compiling Python to greatly improve the speed of execution.
Conclusion
In summary, Python is a high-level programming language because it’s highly readable by humans. In fact, Python is among the highest-level programming languages of all because it’s so close to the English language.
It should also be noted that most programming languages are considered to be “high-level,” with the exception of Machine Language and Assembly Language.
If you want to learn how to program with Python, check out these 15 fun Python projects for beginners. There is a full video tutorial that walks you through each project, step-by-step. And it’s absolutely FREE!