Why didn't the above one works ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why didn't the above one works ???

I need some help with the function keyword in phyton. I typed two codes, but one worked and one didn't, even though they are both strings. Can somebody help me with it. https://code.sololearn.com/c02tRdev3PdO/?ref=app

3rd Sep 2019, 4:59 PM
Xeltion
Xeltion - avatar
2 Answers
+ 3
Xeltion this is because \ is an escape character. Basically it ignores any character that follows it or changes its meaning to a normal string. for example normally print(“””) wouldnt work and give you and eof error, but print(“\””) does work because it ignores the meaning of the middle “ it is in the Python course btw.
3rd Sep 2019, 5:31 PM
Brave Tea
Brave Tea - avatar
+ 1
Thanks, but why does only a single ' \' didn't work ?
3rd Sep 2019, 5:11 PM
Xeltion
Xeltion - avatar