Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Your First Program · Lesson 5 of 11

The print() Function

A free lesson from Swipe Coding · Python, level 2 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
print() is the very first tool you'll reach for, over and over. 🐍

The print() function displays output in the terminal — it is how a Python program communicates with whoever is running it. You give print() the value you want to show by placing it inside the parentheses, and it can display text, whole numbers, decimals, and more.

print("Hello!")
print(42)
print(3.14)
print() can display a piece of text in quotes, a whole number, or a decimal number, each on its own line.

print() can also accept several values at once, separated by commas. When you do this, print() automatically places a single space between each value and joins everything into one line of output.

name = "Ada"
age = 36
print("Name:", name, "Age:", age)
Passing several values separated by commas. This prints: Name: Ada Age: 36
🤖
These two keyword arguments quietly control more of your output formatting than you might expect. 🖨️

You can customize how print() joins multiple values using its sep keyword argument, which stands for "separator" — by default it is a single space (" "). You can also control what print() adds after everything is printed using its end keyword argument, which defaults to a newline character ("\n"), moving the cursor down to the next line for whatever gets printed next.

print("a", "b", "c", sep="-")
print("Hi", end="")
print(" there!")
sep="-" joins the values with dashes instead of spaces, printing "a-b-c". end="" removes the usual newline, so "Hi" and " there!" end up on the same line: "Hi there!"
Fill in the blank

By default, the sep keyword argument of print() places a single ____ between each value you pass to it.

Quick check

What does the end keyword argument of print() control?

True or false

By default, print() automatically starts a new line after printing its output.

Keep your streak going in Swipe Coding

Swipe through every level of Python on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →