How To Print With Python 3

In this Python 3 post, we will learn how to print output to the screen using a Python 3 program.

Before we start, I’m assuming you have Python 3 installed on your machine. If you are running Linux or macOS, it is probably already installed.

Print

With Python built-in printing function, we can easily print text, numbers and variables to the screen.

Let’s start creating a Python program using the following line, which will create a .py file.

touch lab01.py

Inside the file, I will add the print function with a simple text string.

print ("Hello World!")

To run the program, I will use the following command.

python3 lab01.py

The output should look like this:

Hello world!

Leave a comment

Your email address will not be published. Required fields are marked *