S Sumathi
last year
Scountry asked

In Python, can we print text on different lines using a single print()?

Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Harit,

Yes. Put \n inside the string where you want a new line.

Example:

print("Hello\nHow are you?")

This prints Hello on one line and How are you? on the next.

If you have more questions, I am here to help 😊

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