+ 1

but even in a string aren't we suppose to give a backslash before using a quote inside another quote?? ....in Python

3rd Apr 2018, 7:24 PM
Chandreyee Manna
Chandreyee Manna - avatar
5 Antworten
+ 3
If you start your string with double quotes, it must end with double quotes. All that comes before the second double quotes will be part of the string. Thus, you can include single quotes in there.
3rd Apr 2018, 10:45 PM
Pedro Demingos
Pedro Demingos - avatar
0
Yes, you are supposed to. but the inside quote character must be scaped with "\" character. An example would be: print('print(\"hey\")')
3rd Apr 2018, 7:25 PM
Bebida Roja
Bebida Roja - avatar
0
so what will the output of print("print('print')") be?
3rd Apr 2018, 7:26 PM
Chandreyee Manna
Chandreyee Manna - avatar
0
Chandreyee Manna it will cause errors Edit: didn't read the code correctly it would not cause an error in this case. If it was print("print("hey")") then it would case one.
3rd Apr 2018, 7:34 PM
TurtleShell
TurtleShell - avatar
0
but the answer shown is print"print" ......
3rd Apr 2018, 7:35 PM
Chandreyee Manna
Chandreyee Manna - avatar