10 Antworten
+ 5
In my early days of learning Python, I always use single quotation marks ' '
But since I started to learn C++ in which the single quotation mark ' ' is used for char data type and not string, I started to use double quotation marks instead.
If you know you will learn other programming language, then use double quotation mark so you won't get confused and to have no need to adjust.
+ 3
It's better to know how both can be used. Then you can pick your favourite one and use it.
+ 2
in C we use ' ' single quotes to store char and " " quotes to store strings
in python you can use both
if you want to use single quote in your string then you have to store that string inside double quotes
and vice versa..
Ex.
print("I'll be their")
print(' he said, "I will come" ')
look the quotes carefully!
+ 1
Good to know. Thanks!
+ 1
Use single quotes sir. It is better because I said so.
+ 1
thanks for all the great advice!
0
I learned python in a different couse which traditionally used double quotes, so of course I naturally feel that’s better 😺. Also, if you’re going to use an apostrophe in the string, double quotes are definitely better.
0
it’s like commas in grammar. Some teachers love commas and use them as often as they can, other teachers hate them. It depends on who taught you, really, and whats more readable in the code.
0
Always aim for clarity. 😊