Using "\n" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Using "\n"

print("bruh","\n","dood") This code gives the output bruh dood Why is there some empty space before dood? How can I do this without that empty space?

22nd Jul 2019, 2:51 PM
ERROR_404
ERROR_404 - avatar
3 Answers
+ 10
you can do it this way by including the new line escape sequence in front of the text for the 2nd string which should appear as a new line. print("bruh","\ndood")
22nd Jul 2019, 3:06 PM
Lothar
Lothar - avatar
+ 9
I believe it's because you separated the words with a coma. to fix, I would use only on string. like this: print("bruh\ndood") then the output would be: bruh dood
22nd Jul 2019, 3:00 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 2
Thanks guys
23rd Jul 2019, 12:42 AM
ERROR_404
ERROR_404 - avatar