Text output

we can output to the terminal with print function. In this article we’ll show you how to
output text to the screen with Python.

Related Courses:


To output text to the screen you will need one line of code:

If you run the program:

Hello World

Print newline

To write multiple lines, add the ‘\n’ character:

Results in:

Hello World
This is a message
Note: the characters \n create a new line


Print variables

To print variables:

This will show:


To print multiple variables on one line:

Will give you:

x = 2, y = 3