+ 2
SL python challenges (")
I have seen in many python SL challenges just using (") What is that? Pic proof https://www.sololearn.com/post/85026/?ref=app
13 Answers
+ 8
'' is an empty string. type('') is str (string). The code checks if at least one of the arguments is a string. If that's the case, both arguments are converted to strings and concatenated. If not, their sum is returned
+ 5
You can never use a single " (double quote) anywhere in your code (unless it is escaped: \"). If you see something that looks like a single double quote you can be sure that it's actually a '' (double single quote)
+ 4
HonFu I understand that but at least ,it shall be clear that they are two single quotes not a double quote...
'' "
Can you tell of the above which is
Single quotes and which is double?
+ 2
Empty string.
+ 2
If they spread out the quotes, the player might suspect whitespace. Then it would be no empty string.
+ 2
Hehe, no. :)
Yeah, it is a bit awkward. One has to assume an empty string and hope that was meant.
+ 2
And I dunno what would sololearn lose to make it "" like other languages for the sake of simplicity
+ 2
It would suggest that single quotes are not the default in Python.
But they are!
Whenever you create a string in interactive mode using any combination of quotes, it will be changed to two single quotes.
It doesn't necessarily matter, because Python can use all of them; but I think it's a good idea to make the riddles look like an actual code of that language, not a fiction of it.
+ 2
Anna HonFu
https://code.sololearn.com/cSyb0L5FpRl2/?ref=app
It is clear first one is single quote and second one is double and also first one is empty so in the challenges at least that much 'space' shall be there
+ 1
It would probably be good if code was presented with equally wide letters as you'd normally have it anyway.
+ 1
In Challenges you can't use 'copy text' though. đ
0
Do you both think this will lead anywhere? Everybody has stopped caring!