+ 2
I don't know how to use \n , I mean at what place must it be used
4 Answers
+ 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!
+ 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.
+ 1
thanks alot I tried it and it was correct
0
Itās \ā