- 1
>>> print("Hello\nWorld!") & >>> print('Hello\nWorld!')
Is the output differt for these 2 strings? Diference between using single ' n double " ??
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.
+ 3
I don't see a difference, you can try it yourself:
https://code.sololearn.com/c0U6Sz2dF7Vg/?ref=app
+ 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).