Why do we need a double quote when we can write texts with a single quote | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why do we need a double quote when we can write texts with a single quote

14th Jun 2019, 7:45 AM
dorjee wangchuk
dorjee wangchuk - avatar
3 Answers
+ 4
In python, both single quote and double quote are same and are interchangeable. But if you are using single quote at beginning then end must also have single quote. Same with double quote. In other languages like C, C++ and Java the meaning of single quote and double quote is different. In Java :- Single Quote means a character And double quote means a String. Hope this helps😄
14th Jun 2019, 7:56 AM
Deepak Kumar
Deepak Kumar - avatar
+ 4
It allows you to write: print("That's what you're dealing with.") instead of: print('That\'s what you\'re dealing with.')
14th Jun 2019, 8:33 AM
HonFu
HonFu - avatar
+ 1
You can use which you prefer, that's maybe because Python does not have datatype char. Pythoners typically use single quotes, but I personally use double quotes, so it wouldn't cause any confusion in other programming languages, which only supports " for strings.
14th Jun 2019, 8:02 AM
Seb TheS
Seb TheS - avatar