What is the difference when we use " " and ' ' in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

What is the difference when we use " " and ' ' in python

7th Jul 2016, 8:22 AM
Evcheto Novakova
Evcheto Novakova - avatar
7 Answers
+ 4
They are the same, the only difference between them may be which you prefer.
7th Jul 2016, 9:09 AM
Zedd Zhou
Zedd Zhou - avatar
+ 4
they are the same, but if you are going to use one in the string, use the other one around it
5th Nov 2016, 1:39 PM
Redstone Tehnik
Redstone Tehnik - avatar
+ 1
"Ali's" is ok but 'Ali's' is Error
7th Jul 2016, 10:34 AM
Uğur Atakan Sürmeli
Uğur Atakan Sürmeli - avatar
+ 1
In python, they are interchangeable. In other languages they may not be, such as java or C.
7th Jul 2016, 6:01 PM
Gershon Fosu
Gershon Fosu - avatar
+ 1
" " means a string ie a sentence....while ' ' means a character ie a letter
4th Nov 2016, 11:37 AM
Biko
Biko - avatar
0
if Use to ' you can t ' in Text so print 'ali\'s ' Use
7th Jul 2016, 10:37 AM
Uğur Atakan Sürmeli
Uğur Atakan Sürmeli - avatar
0
@Evcheto Novakova. they would function the same way used separately. the difference comes when you can use both of them on one line. say: name="I'm Evcheto Novakova" using them together this way and many more makes it easier to write codes. but using it this way: 'I'm Evcheto Novakova' would result in a string error. otherwise, either one of them works fine.
17th Nov 2016, 11:01 AM
Codde Ded
Codde Ded - avatar