Python Environment

This is part of “An intro to Python” series of posts, with content from the Enki app. If you stumbled upon this, you can start from the beginning.

Python comes pre-installed on most operating systems. It can also be downloaded online for free.

Once installed, you can type python3, python or python -i to run the Python interpreter¹ from the shell²:

This gives you a local interactive environment where you can run Python code and output the results.

The Python interpreter is your playground. So test things, go crazy!

It is the ideal place for testing out small pieces of code or calculations.

For example:

For anything longer than a few lines of code, it’s much easier to use a text editor.

Some of the most popular text editors are Notepad, Atom, VIM, Sublime Text and Visual Studio Code.

We recommend Visual Studio Code for beginners.

Once you’re using a text editor you can save files using a .py extension and then open them from the shell by running:

Hello World!

Let’s write our first Python program, and print Hello World! to our screen!

To do this, in the Python interpreter, use Python’s print function as follows:

The output displayed in the shell is:

In this program, we’ve used Python’s built-in print function. Soon you’ll learn about many more of these built-in functions and how to create your own.


[1] The Python interpreter is the application that runs your Python script.

The interpreter is a quick way to explore Python and try out code without creating a file. It is a Read-Eval-Print Loop, or REPL, a tool offered by many modern programming languages.

To use it, you launch the Python interpreter with python3, python or python -i and type your Python code at the prompt. The interpreter evaluates the code you type and displays the results.

[2] The shell, also known as the command line, is a program which processes shell scripts, like Bash. Shell scripts allow you to manipulate and navigate between files, execute programs, and print text. The shell is run through the terminal.

Learn More

Chat with us to learn more

Continue reading

Our newsletter

Get the best curated articles

No spam!