Editors#

Interactive Shell#

With the interactive shell you can easily run most of the examples in this tutorial. Later, you will also learn how to easily include code written to a file as a module.

Type python3 in the terminal:

$ python3
Python 3.10.4 (default, Mar 23 2022, 17:29:05)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Open a terminal window and enter python3:

$ python3
Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Note

If you get the error message Command not found, you can run Update Shell Profile, which can be found in Applications/Python3.10.

You can start the interactive Python shell in Start ‣ Applications ‣ Python 3.10.

Alternatively, you can search for the directly executable file Python.exe, for example in C:\Users\VEIT\AppData\Local\Programs\Python\Python310-64 and then double-click.

You can scroll through previous entries with the arrow keys Home, End, Page up and Page down and repeat with the Enter key.

Exiting the interactive shell#

To exit the interactive shell, simply use Ctrl-d on Linux and macOS or Ctrl-z on Windows. Alternatively, you can type exit().

IDLE#

IDLE is the acronym for integrated development environment and combines an interactive interpreter with code editing and debugging tools. It is very easy to execute on the various platforms:

Enter the following into your terminal:

$ idle-python3.10

You can start IDLE in Windows ‣ All Apps ‣ IDLE (Python GUI)

You can scroll through the history of previous commands with the alt-p and alt-n keys.