+ 1

Why does this happen?

If you run the code "print("/n/n/n")", it outputs "../Playground/". Why? https://code.sololearn.com/c5qAoj3jnmWp/?ref=app

12th Jul 2022, 3:52 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
6 Réponses
+ 3
AJ 🇺🇦#PeaceForUkraine🇺🇦 / represent file path location so you get /Playground It is not a bug You should do \n
12th Jul 2022, 4:09 PM
A͢J
A͢J - avatar
+ 1
I know that. Thanks for telling me how and why that happens!
12th Jul 2022, 4:25 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
+ 1
Vlad Apet \n creates new line not /n /n is not a right syntax
12th Jul 2022, 5:05 PM
A͢J
A͢J - avatar
+ 1
Exactly! And then there is \t for tabulation and \a for audio playback. The "\" character tells the compiler that it is followed not by simple text, but by a command. ( I don't know how for python, but for c++ it is )
12th Jul 2022, 5:21 PM
Vlad Apet
+ 1
Thanks everyone
12th Jul 2022, 6:07 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
Haha, I found it really interesting, but now I get it because \n creates a new line. In C++, this means the same thing. ( I started learning python without even starting:) )
12th Jul 2022, 4:50 PM
Vlad Apet