Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
newline
print
communitycreator

How to print without newline in Python

Ahmad Youasf

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)
Print() function examples

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.

RELATED TAGS

python
newline
print
communitycreator
RELATED COURSES

View all Courses

Keep Exploring