Extras 1.1: Python Interpreter

Python is a high-level programming language. As such, it can be understood by humans but not by computers. You can write Python code in any plain-text editor – Notepad, Notepad++, Emacs, etc.  But if you want to execute (or run) a Python program you need something more.

Unlike C, C++, Java, and many other languages which are compiled languages, Python is an interpreted language. The main difference between compiled and interpreted languages is that programs written in a compiled language are translated into the machine language as a whole, at creation time. They are compiled by a program called a compiler into an executable. The whole executable is then sent to the operating system for execution. A compiler compiling an entire program is analogous to a real-language translator, translating an entire book to a different language.

On the other hand, programs written in an interpreted language are translated to machine language and sent to the operating system one statement at a time at execution time. The programs that translate one statement at a time are called interpreters. In a way, programming-language interpreters and real-language interpreters work alike – each time they translate just a small fraction (a statement or a sentence) of the whole program or  speech.

There are pros and cons to either approach. For us, it’s important to remember that Python source code needs to be interpreted. This means that before we can do anything in Python, we must at least install a Python interpreter.

[prev-next-ad1 prev=”https://codewithsara.com/python-with-sara/python-101/u1-starting-with-python/u1-answers-solutions/” next=”https://codewithsara.com/python-with-sara/python-101/u1-starting-with-python/u1e2-python-concepts/”]