February 5, 2021•2 min read

Playing with the Python Interpreter

Python ships with an interactive interpreter you can use to run Python code right there in the terminal.

Read in Indonesian

Okee, here we go again. Last time we installed the Python interpreter. This time we'll play with the Python 3 interpreter and get to know what an interpreter actually is.

What Is an Interpreter?

In the previous tutorial we kept running into the term interpreter. So what is an interpreter?

An interpreter is a program that works to translate the code you type on the spot, without compiling it into machine language as a whole first.

The interpreter reads your code line by line. After that reading, the code you wrote gets executed immediately. That's different from a compiler, which turns every line into machine language first and only then runs it (with an .exe file, for example).

Now, because Python is an interpreted language, you don't have to make a file first to run Python code. You can use the interactive interpreter that's already available.

Using the Python 3 Interactive Interpreter

First, open the interpreter on your machine.

On Windows you can just click the python 3 icon as in the previous piece.

On Linux, open a terminal and run the following command

SHELL
python3  # or
python

Siip... once that's done, the terminal or Python console window opens right away. The look on Windows and Linux isn't much different.

📷 Illustration: the Python 3 interactive terminal showing version details and the three-angle-bracket prompt.

On that screen we're given the Python version, the release date, and some supporting technical details. On the bottom line there's a >>> sign, and this is the prompt where you type Python commands.

Now try typing the following command and press enter

PYTHON
print("Hello World")

As you'd expect, this code prints "Hello World" on your screen. Once enter is pressed, the output prints right below the command you wrote. Roughly like this:

TEXT
>>> print("Hello World")
Hello World

See, you don't need a special file to run python code. That's because python code is executed directly by the interpreter.

Yayy... congratulations, your first python code is done

Last, to leave the Python interpreter display you can type the following command

PYTHON
exit()

Wrapping Up

That's it, there doesn't seem to be anything else special about this interpreter display. It really is that simple, but something this simple can be turned into something remarkable.

Next we'll keep using this interpreter display to get to know some basic python syntax, so don't forget how to open the python interpreter...

That's it for this time, hope it helps. See ya 👋

Get better at shipping code.

Join the other developers getting tech updates, tips, and relaxed tutorials in their inbox every week.

Stay in the loop

Tech updates, coding tips, and relaxed insights straight to your inbox every week.

No spam. Unsubscribe anytime.

Read next

See all

For developers who learn by struggling

© 2026 Inva.dev.