Lesson · Chapter: Print+10 XP for reading
What is Print?
The print() function is how your program talks to you! It displays text on the screen.
Where you'll use this
Every message a game shows you, every receipt, every chat reply — a program printed it. print() is how code talks to people.
Prefer to watch? This chapter in 100 seconds:
Printing Text
To print text, put it inside quotes and wrap it with print():
python
print("Hello!")
Output
Press Run to see the output.
This shows:
Hello!
You can use single quotes too:
python
print('Hello!')
Output
Press Run to see the output.
Printing Numbers
You can print numbers without quotes:
python
print(42)
print(3.14)
Output
Press Run to see the output.
Printing Multiple Things
Use commas to print several things on one line. Python adds spaces between them:
python
print("I am", 10, "years old")
Output
Press Run to see the output.
Output:
I am 10 years old
Multiple Lines
Each print() starts a new line:
python
print("Line 1")
print("Line 2")
print("Line 3")
Output
Press Run to see the output.
Blank Lines
Call print() with nothing inside to print a blank line:
python
print("Top")
print()
print("Bottom")
Output
Press Run to see the output.
Output:
Top Bottom
Now let's practice!
Did you know?
The very first "Hello, World!" program appeared in a programming tutorial in the 1970s — and ever since, it's been the traditional first program for every language. You're part of a 50-year-old tradition.
Check yourself
Pause & predict — what will this print?
print("3 + 4")