Python Program to Print Output Without a Newline

Python

Nicesnippets

305

19-06-2021


Hi guys,

In this blog, how to print output without a new line. there is an additional parameter introduced for print() called end=. This parameter takes care of removing the newline that is added by default in print().

Python print() built-in function is used to print the given content inside the command prompt. The default functionality of Python print is that it adds a newline character at the end.

Here i will give you simple example of print output without a newline. So let's see the below example:

Example 1


newline.py

# print each statement on a new line

print("Python")

print("is high level language.")

# new line

print()

# print both the statements on a single line

print("Python", end=" ")

print("is high level language.")

Output

Python

is high level language.

Python is high level language.

It will help you....


Recommended Posts