+ 1
The use of newline.
Why do we use \n ? What is the difference between using a “space” and “\n”?
2 Respostas
+ 6
We use \n if we want the text after that to be on the next line. Space simply separates text between your characters/words, without it, text won't be much readable.
print('This line has some space in between and \n a few \n newline characters', 'Thislinehasnospaceinbetweenbut\nafew\nnewlinecharacters')
+ 4
To add a newline in a string, use the character combination \n:
>>> print("Languages:\nPython\nC\nJavaScript")
Languages:
Python
C
JavaScript
To add a tab (whitespace) to your text, use the character combination \t as shown at (1):
>>> print("Python")
Python
>>> print("\tPython") (1)
Python