Tom
asked

Expert
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.
Our Experts
Sanjeev PanditPrincipal Engineer
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Anuj ShresthaTech Lead
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer