Kodeclik Logo

Our Programs

Courses

Learn More

Schedule

Kodeclik Blog

How to add space between lines in Python output

Have you ever struggled with making your Python console output more readable? Maybe you are displaying some game text, or perhaps you are formatting report outputs, and you wish to add extra lines to improve readability.

In this guide, we'll explore three simple yet effective methods to add line spaces in Python output. These techniques will help you transform cluttered console text into clean, professional-looking displays!

Method 1: Use empty print() statements

Conider the program:

print("First line")
print()  # Empty print statement
print("Second line")

The empty print() statement creates a single blank line between text outputs. This method is straightforward and readable, making it ideal for simple spacing needs. Each empty print() call adds one blank line because the print function automatically adds a newline character by default.

The output will be (notice the blank line between the first and second lines):

How to add lines of space in Python text output
First line

Second line

Method 2: Use the \n escape sequence

This approach is simpler:

print("First line\n\nSecond line")

The \n escape sequence creates a new line wherever it appears in the string. Using multiple \n characters in sequence creates multiple blank lines. This method is particularly useful when you need to embed line breaks within a single string. Each \n represents one line break, so \n\n creates two line breaks, resulting in one blank line between text.

The output is the same as before:

print("First line\n\nSecond line")

Method 3: Use print() with end parameter

Here is the third approach:

print("First line", end="\n\n")
print("Second line")

Using the end parameter in the print() function allows precise control over the spacing. By default, print() uses \n as the end parameter. So one “\n” is to move to the second line, but by explicitly setting end="\n\n", you are adding an extra blank line after the text. This method offers more flexibility in controlling the output format and is especially useful when you need different spacing patterns throughout your code.

When would you need to use multiple lines of space in your Python program’s output? Below are some situations for you to consider, with the programs followed by their output:

Menu Display

print("=== MAIN MENU ===")
print("\n\n")  # Creates visual separation
print("1. Start Game")
print("2. Settings")
print("3. Exit")

Note that the above program will actually output three blank lines because a print by default will give you one space plus we have two newline characters.

=== MAIN MENU ===



1. Start Game
2. Settings
3. Exit

Report Sections

print("SALES REPORT")
print("Total Revenue: $50,000")
print("\n\n")  # Separates sections clearly
print("EXPENSE BREAKDOWN")
print("Marketing: $10,000")
SALES REPORT
Total Revenue: $50,000



EXPENSE BREAKDOWN
Marketing: $10,000

Game Text Output

print("You enter the dark cave...")
print("\n\n\n")  # Creates dramatic pause effect
print("A monster appears!")
You enter the dark cave...




A monster appears!

Form Output

print("Please fill in your details:")
print("\n")  # Single space for better form layout
print("Name: _______________")
print("Age:  _______________")
print("\n\n")  # Double space before submission button
print("[Submit]")
Please fill in your details:


Name: _______________
Age:  _______________



[Submit]

These examples demonstrate how strategic use of blank lines can improve user experience by creating visual hierarchy and making output more organized and easier to read5. The spacing helps separate different sections of information, create emphasis, or provide natural pauses in interactive applications.

Enjoy this blogpost? Want to learn Python with us? Sign up for 1:1 or small group classes.

Kodeclik sidebar newsletter

Join our mailing list

Subscribe to get updates about our classes, camps, coupons, and more.

About

Kodeclik is an online coding academy for kids and teens to learn real world programming. Kids are introduced to coding in a fun and exciting way and are challeged to higher levels with engaging, high quality content.

Copyright @ Kodeclik 2025. All rights reserved.