+ 3

Python double quotes

Can someone please explain the following? "double quotes cant be directly included in a double string". Thank you.

24th Feb 2018, 11:12 PM
arbaaz
3 Respostas
+ 5
If you want to print the following: “No!”, she said. You cant use: print(“”No!”, she said.”) Because the quotes will mess up with the string. I believe thats what your sentence there means. But you could use: print(‘“No!”, she said.’) Because then Python will know what you want.
24th Feb 2018, 11:30 PM
Pedro Demingos
Pedro Demingos - avatar
+ 3
It goes the same with single quotes. You need to use the escape character backslash '\' on each single or double quote to make it work. Check this code: https://code.sololearn.com/cNs0q66noLwf/?ref=app
25th Feb 2018, 12:00 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Thank you for your answers.
26th Feb 2018, 7:35 PM
arbaaz