SAT · 15 AUG 2026 · 08:47 BST
O
OpenPress V 1.01
Breaking
Python Basics · Part 3 of 3 Beginner · 3 min read
Part 3 of 3 · 100% through this series
03

Python Getting Started

Python Getting Started: The print() Function

Welcome to your Python journey! If you are just getting started with Python, the very first function you will learn is the print() function. In this tutorial, we will explain what the print function is, why it is used, and show you several examples of how to use it in your code.

What is the print() function?

In Python, print() is a built-in function. A function is a block of reusable code that performs a specific task. The task of the print() function is to output data to the standard output device, which is usually your computer screen (the console or terminal).

What is the use of print()?

The primary use of the print() function is to display information to the user. However, it is also the most valuable tool for a programmer. Developers use print() to:

  • Display the final results of a calculation or program.
  • Show messages to the user (like “Welcome!” or “Error!”).
  • Debug code: By printing the value of variables at different stages of a program, you can see exactly what your code is doing behind the scenes.

Python print() Examples

Let’s look at how to use the print function with some practical examples.

Example 1: Printing a Simple Text String

To print text, you must wrap the words inside single quotes (' ') or double quotes (" ").

Python

print("Hello, World!")
print('Welcome to Python getting started.')

Output:

Hello, World!
Welcome to Python getting started.

Example 2: Printing Numbers

You do not need quotes when printing numbers or mathematical calculations.

print(2023)
print(10 + 5)

Output:

2023
15

Example 3: Printing Multiple Items

You can print multiple items in a single print statement by separating them with a comma. Python will automatically add a space between them.

name = "Alice"
age = 25
print("My name is", name, "and I am", age, "years old.")

Output:

My name is Alice and I am 25 years old.

Example 4: Using f-strings (Formatted Strings)

In modern Python (version 3.6 and above), the best way to combine text and variables is by using “f-strings”. Simply put an f before your quotes and place variables inside curly brackets {}.

language = "Python"
print(f"I am learning {language}!")

Output:

I am learning Python!

Example 5: Preventing a New Line

By default, every print() statement ends with an invisible “new line” character, meaning the next print will start on a new line. You can change this behavior using the end parameter.

print("Python is ", end="")
print("awesome!")

Output:

Python is awesome!

Conclusion

The print() function is your window into the Python program’s brain. As you get started with Python, you will find yourself using it constantly to test your code and see your results. Try copying the examples above into your own Python environment and see what happens!

You're caught up

Get part 4 the day it's out

One email when the next part of this series is published. No other mailings, unsubscribe with one click.

Please log in to leave a comment.