Printing Multiple Values

Printing + Comments

Printing Multiple Values

In this tutorial, we'll combine labels, values, and separators in output.

print() can display more than one value at a time. Put commas between the values:

name = "Omar"
age = 11

print("Name:", name)
print("Age:", age)

Output:

Name: Omar
Age: 11

This is easier than trying to join everything into one string, especially when some values are numbers.

Commas Add Spaces

When you use commas, Python automatically inserts spaces:

print("Python", "is", "useful")

Output:

Python is useful

That automatic spacing is usually helpful.

Changing the Separator

The separator is what Python puts between printed values. By default, it is a space. You can change it with sep.

print("2026", "07", "10", sep="-")

Output:

2026-07-10

Another example:

print("red", "green", "blue", sep=", ")

Output:

red, green, blue

Changing the Ending

By default, print() ends with a new line. You can change that with end.

print("Loading", end="...")
print("done")

Output:

Loading...done

You will not need end all the time, but it is useful to know it exists.

Common Mistake

Do not use + to join strings and numbers:

age = 11
print("Age: " + age)  # error

Use commas instead:

print("Age:", age)

Practice

Create variables for a product, price, and quantity. Print them in a readable sentence.