Python Print Without Arguments

Rate this post

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!

Coders get paid six figures and more because they can solve problems more effectively using machine intelligence and automation.

To become more successful in coding, solve more real problems for real people. 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?

You build high-value coding skills by working on practical coding projects!

Do you want to stop learning with toy projects and focus on practical code projects that earn you money and solve real problems for people?

🚀 If your answer is YES!, consider becoming 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.

If you just want to learn about the freelancing opportunity, feel free to watch my free webinar “How to Build Your High-Income Skill Python” and learn how I grew my coding business online and how you can, too—from the comfort of your own home.

Join the free webinar now!