why do we need newline character '\n' ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why do we need newline character '\n' ?

30th Jul 2016, 5:12 PM
Tom Joseph
Tom Joseph - avatar
7 Answers
+ 2
To insert newline? I always use it.
30th Jul 2016, 5:44 PM
Alireza M
Alireza M - avatar
+ 2
you can also use the three (double) quotes and hit return key where you want to have a new line: print("First string" + ", " + """second<return>string""")
31st Jul 2016, 8:51 AM
Matthias Link
Matthias Link - avatar
+ 2
you can also use the three (double) quotes and hit return key where you want to have a new line: print("First string" + ", " + """second<return>string""")
31st Jul 2016, 8:52 AM
Matthias Link
Matthias Link - avatar
0
we need a newline character "\n" to enter a new line while printing something on the screen
30th Jul 2016, 5:55 PM
Aakash Sharma
Aakash Sharma - avatar
0
You need the new line character '\n' if you want to format the output, if you want print a string into more than one line.
30th Jul 2016, 10:26 PM
Anita Gulyasne Goldpergel
Anita Gulyasne Goldpergel - avatar
0
Consider typing in notepad or something similar where when you hit the 'enter' button (which has no representable letter or symbol on screen) to go to a newline. There is a lot of variation in the actual implementation but basically you can think of it as entering a \n when you press the key. Same situation with the 'tab' button inserting a \t or equivalent. You have always used them but now they are exposed to you through programming.
31st Jul 2016, 1:32 AM
Eric Kozub
0
write "\""
2nd Aug 2016, 1:49 AM
John Orielly
John Orielly - avatar