How to print without newline in Python

Python has a predefined format. When we use the print() function, it ends with a newline by default, and the cursor automatically moves to the next line. To print a statement without a newline, we use a function that prints a statement in a line.

Syntax

The syntax is shown below:

print(statment, end =" ")

Code

print("Educative Company!")
print("My name is John and I works in eduactive company as a project manager")
print("Educative Company! ", end =" ")
print("You are welcome")
a=("Laptop","Mobile","Tablet")
print(a)

Code explanation

  • Lines 1 and 2: The print() method displays the statement, which ends with a newline.
  • Lines 4 and 5: We use a function that prints a statement in one line.

Free Resources