Tom Jel
2 years ago
Tomcountry asked

How to use print without new line sign?

Kelish Rai
Expert
2 years ago
Kelish Rai answered

By default, print() adds a new line after each call, which is why the above example prints on separate lines. To prevent this, you can add end=" " in your print() statement. For example,


print(11, end=" ")
print("How are you?")

Output

11 How are you?

The end=" " part tells Python to end the print() statement with a space instead of a new line.

Hope this helps. If you have more questions, feel free to let me know. I'm happy to help.

Python
This question was asked as part of the Getting started with Python course.