What is exact difference in ' ' and " " | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is exact difference in ' ' and " "

difference in ' ' & " "

28th Jan 2017, 5:39 PM
Harshvardhan Patel
Harshvardhan Patel - avatar
7 Answers
+ 13
No difference.
28th Jan 2017, 5:50 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
That is in python, in other languages ' is used to represent chars and " to represent strings. For example in c# 'c' is a char, but "c" is a string with length one
28th Jan 2017, 5:55 PM
Антон Обожин
Антон Обожин - avatar
+ 2
both are used to include strings, but if you use ' you do not need to escape " and vice verca For example you can write "doesn't" instead of 'doesn\'t' or 'some "name"' instead of "some \"name\""
28th Jan 2017, 5:53 PM
Антон Обожин
Антон Обожин - avatar
+ 1
They are pretty much the same, they allow for one the be used inside the other for example: >>>print('Johnny said "hello"') Johnny said "hello" This is for those serious grammar nazis, if you need to use both you can do: >>>print(""""don't touch Johnny's toys" said mom "And stay out!"""") "don't touch Johnny's toys" said mom "And stay out!" The three quotation marks can also support multiple lines.
28th Jan 2017, 11:52 PM
Kaden
Kaden - avatar
0
both are same ???
28th Jan 2017, 5:51 PM
Harshvardhan Patel
Harshvardhan Patel - avatar
0
if you use quotes within quotes you must diversify otherwise no difference
28th Jan 2017, 6:42 PM
Andre van Rensburg
Andre van Rensburg - avatar
0
no different
29th Jan 2017, 5:06 AM
Thevabalan Kayani
Thevabalan Kayani - avatar