+ 2

I don't know how to use \n , I mean at what place must it be used

2nd Feb 2018, 3:52 PM
piyush v
4 Respuestas
+ 2
\n is used to declare a linebreak in a string. For example, this line is on a new line, which would be the result of using \n. It can be used when workibg with strings, so if you want to print 2 strings on separate lines, you can separate them via \n. Hope this helped!
2nd Feb 2018, 3:58 PM
Faisal
Faisal - avatar
+ 2
\n is simply the character that indicates the beginning of a new line li ke here. There is a \n character between the 'i' and 'k' in the word like. Except it's displayed as a new line instead of as li\nke. In python doing something like print("Hello World") actually prints "Hello World\n", because print automatically adds \n to the end of the string. If you want to change that you can do print("Hello ", end ="") print(name) And that will print "Hello Mike" (for example) on the same line.
2nd Feb 2018, 4:02 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
thanks alot I tried it and it was correct
2nd Feb 2018, 4:22 PM
piyush v
0
It’s \”
2nd Feb 2018, 8:39 PM
tatiana