>>> print("Hello\nWorld!") & >>> print('Hello\nWorld!') | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

>>> print("Hello\nWorld!") & >>> print('Hello\nWorld!')

Is the output differt for these 2 strings? Diference between using single ' n double " ??

8th Apr 2018, 6:10 PM
Danny.P
Danny.P - avatar
3 Answers
+ 1
No difference. Both single quotes and double quotes work the same. You just have to make sure you use the same ones together i.e. opening and closing a string with either both single, or both double - not mixing them.
8th Apr 2018, 7:58 PM
Russ
Russ - avatar
+ 3
I don't see a difference, you can try it yourself: https://code.sololearn.com/c0U6Sz2dF7Vg/?ref=app
8th Apr 2018, 6:16 PM
Paul
Paul - avatar
+ 2
The more interesting thing to try is: print('"Hello World"') print("'Hello World'") That way you can use quotation marks in strings without having to use extra break (backslash).
8th Apr 2018, 8:27 PM
Marco Polidori
Marco Polidori - avatar