Skip to content

1. Running Python

Open the Linux Terminal tile in the lab portal. There are two ways to run Python there.

Interactively, for quick experiments — type python3 and you get a prompt where every line runs immediately:

$ python3
>>> print("Hello, world!")
Hello, world!
>>> exit()

As a script file, for anything longer than a line or two. Create a file with a text editor like nano:

$ nano hello.py

Type your code, then press Ctrl+O to save and Ctrl+X to exit. Run the file with:

$ python3 hello.py
Hello, world!
# hello.py
print("Hello, world!")

Try it

Write a file called hello.py that prints your name, then run it with python3 hello.py.

Tip

nano shows its shortcuts along the bottom of the screen — the ^ symbol means Ctrl, so ^O is Ctrl+O.

Next: Variables and Types →