+ 1

What is the output of the following code and why? #python 3

print("\") print("\\") print("\t") print("\\t") print("\\\t")

25th Feb 2020, 9:09 PM
Krishna Kadam
Krishna Kadam - avatar
6 Respuestas
+ 3
Go to Sololearn's playground and paste the code there to see the output.
25th Feb 2020, 9:13 PM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 2
Error Line 1.
25th Feb 2020, 10:09 PM
Vishal
+ 2
Thanks ✌🏼
26th Feb 2020, 5:26 AM
Krishna Kadam
Krishna Kadam - avatar
+ 1
I know the output... Of each line, but it's confusing to understand escape sequences
25th Feb 2020, 10:10 PM
Krishna Kadam
Krishna Kadam - avatar
+ 1
The first line throws an error, because backlashes in a string are used for special characters, such as "\n" means new line. "\\" will print only one \ Read this: https://docs.python.org/2.0/ref/strings.html
25th Feb 2020, 10:26 PM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
You got a error in first line beacouse backslace is use as a special symbol that's why you got a error
26th Feb 2020, 7:31 PM
Ujjwal Deval
Ujjwal Deval - avatar