PRO
Pius
asked

Expert
Udayan Shakya answered
Hello, Pius! If you want to print \n as part of the string, you'll need to write it as \\n like this:
print ("Hey\\nHow are you")Just like \n is a special code for entering a new line, \\ is special code for entering a single backslash into the string.
So, Python will interpret \\n as:
Print a single backslash '\' followed by the letter 'n'.
Hope that helps! Contact us again if you have further queries.
Python
This question was asked as part of the Learn Python Basics course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
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
