Python Print Without Arguments

Python’s print() function prints a string representation of any number of arguments to the standard output. It has many arguments such as the sep argument to set a custom separator string between the printed objects, the end argument to set a custom ending string, or the file argument to print a string into a file.

Print Without Arguments

You can ´use Python’s print() function without arguments: In that case, Python will print an empty new line to the standard output. Printing without arguments is often used to visually format the output, for example to separate the output into paragraphs by inserting an empty new line.

For example, consider the following code snippet where you use a print statement without arguments to visually separate blocks of inner loop outputs in a nested for loop:

for i in range(5):
    for j in range(3):
        print(i*j)
    print()

The output is nicely formatted into blocks of three lines, i.e., the outputs of running the inner loop to completion:

0
0
0

0
1
2

0
2
4

0
3
6

0
4
8

Here’s what happened if you hadn’t added the empty print() statement without arguments:

for i in range(5):
    for j in range(3):
        print(i*j)

This would’ve produced the visually chaotic output:

0
0
0
0
1
2
0
2
4
0
3
6
0
4
8

You can learn more about the print() function in the detailed blog guide or the following video:

Where to Go From Here?

Enough theory, let’s get some practice!

To become successful in coding, you need to get out there and solve real problems for real people. That’s how you can become a six-figure earner easily. And that’s how you polish the skills you really need in practice. After all, what’s the use of learning theory that nobody ever needs?

Practice projects is how you sharpen your saw in coding!

Do you want to become a code master by focusing on practical code projects that actually earn you money and solve problems for people?

Then become a Python freelance developer! It’s the best way of approaching the task of improving your Python skills—even if you are a complete beginner.

Join my free webinar “How to Build Your High-Income Skill Python” and watch how I grew my coding business online and how you can, too—from the comfort of your own home.

Join the free webinar now!