+ 2

Can someone explain this ?

print(r"/n sololearn") >>>/n sololearn

20th Nov 2020, 11:41 AM
omar_ctr
omar_ctr - avatar
6 Answers
+ 6
r is used for raw string. it prints everything regardless. So instead of '\n' being a newline character it's just a '\' foward slash and an 'n' right next to eachother.
20th Nov 2020, 11:44 AM
Slick
Slick - avatar
+ 2
The r represent raw string and that /n should be \n which mean a new line so the code should be print (r"sololearn"+"\n"); >>sololearn
20th Nov 2020, 11:47 AM
George S Mulbah II
George S Mulbah II - avatar
+ 2
omer_ctr NotAPythonNinja you are right I just corrected it The r represent raw string and that /n should be \n which mean a new line so the code should be print (r"sololearn"+"\n"); >>sololearn
20th Nov 2020, 11:57 AM
George S Mulbah II
George S Mulbah II - avatar
+ 1
Slick thank you so much bro ,this is new for me 👐👐
20th Nov 2020, 11:47 AM
omar_ctr
omar_ctr - avatar
+ 1
George, i sow this in a code challange and it really confused me , the output is really >>>/n sololearn
20th Nov 2020, 11:53 AM
omar_ctr
omar_ctr - avatar
+ 1
Oh yes ,u right bro
20th Nov 2020, 11:55 AM
omar_ctr
omar_ctr - avatar