Printing More Than Once
Lines, blank lines, and combining text
One print is great, but real programs usually show several lines. Good news: you can use print as many times as you like, one after another.
One line each
Each print command puts its text on its own new line:
print("Good morning!")
print("Welcome to Python.")
print("Let's begin.")That shows three separate lines. Each print automatically moves to a fresh line when it's done "" you don't have to do anything special for that.
Printing a blank line
An empty print() "" with nothing inside the brackets "" gives you a blank line. This is handy for adding a little breathing room:
print("Top line")
print()
print("Bottom line")Combining text in one print
You can show several pieces of text in a single print by separating them with commas. Python adds a space between each piece automatically:
print("Tea", "or", "coffee?")That shows: Tea or coffee? on one line.
Tip: Lines that start with # are comments. The computer ignores them completely. They're notes for humans "" a way to leave reminders in your code. You'll see them used throughout these lessons.
Your turn
Run the example, then try adding your own extra print lines to write a short message.
Press “Run code” to see the result.
Quick check
Q1 What does an empty print() with nothing in the brackets do?
Q2 What will print("Tea", "or", "coffee?") show?
Want to save your progress? It's free.
Create a free account