0

in [Variables], ' ' & " " difference?

Is there a difference in the use of ' '(quotation marks) and " "(double quotation marks) in Variables? ex) name = John age = 24 print(name+' is '+age+' years old') print(name+"is"+age+"years old") is this right??

9th Oct 2021, 6:10 AM
Joel
Joel - avatar
5 Réponses
+ 3
No, it isn't right. Values must be in double or single quotes. if not, it will raise Name error Do this... name = "John" age = "24" print(name+' is '+age+' years old') print(name+"is "+age+"years old") Not much different between ' ' and " " a little different is according to Jay Matthews said.
9th Oct 2021, 6:43 AM
Myo Thuzar
Myo Thuzar - avatar
+ 3
Please always tag the language you're asking about. This seems to be about python. In python single and double quotes are interchangeable in almost all situations as long as opening and closing quotes are the same. Jay pointed out the exception above.
9th Oct 2021, 6:48 AM
Simon Sauter
Simon Sauter - avatar
+ 1
Myo Thuzar okay Thank you so much!
9th Oct 2021, 6:54 AM
Joel
Joel - avatar
+ 1
Simon Sauter oh, sorry. It was my first question in Sololearn, so I didn't know that. I'll keep in mind what you pointed out. Thank you very much!
9th Oct 2021, 6:55 AM
Joel
Joel - avatar
0
Jay Matthews oh, now I see.. Thank you so much!
9th Oct 2021, 6:54 AM
Joel
Joel - avatar