Python : Working with the Python Interactive Shell

Louis SanchezAugust 15th 2021, 12:11

We are going to be writing our first program through the Python interactive shell. Before we begin, ensure that you have Python installed on your machine.

Checking our Python Installation

Step 1 : Open the terminal

Step 2 : Type in the command python3 and press Enter. This should open the Python interpreter, and you should see a message containing the Python version you installed.


Working with the Python

Step 1 : At the terminal, enter the following command to run the popular Hello World! program:

print("Hello World!")

Step 2 : Anything you type into the shell is echoed back. Type "Echo" in the shell to check this


Step 3 : You can even do some calculations

14 + 3
12 - 3
-5 + 6*8

Step 4 : Exit the shell by running the exit command