+ 1
but even in a string aren't we suppose to give a backslash before using a quote inside another quote?? ....in Python
5 Answers
+ 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.
0
Yes, you are supposed to. but the inside quote character must be scaped with "\" character.
An example would be:
print('print(\"hey\")')
0
so what will the output of print("print('print')") be?
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.
0
but the answer shown is print"print" ......