+ 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

11th Apr 2019, 8:32 AM
Saksham Jain
Saksham Jain - avatar
13 Réponses
+ 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
11th Apr 2019, 8:40 AM
Anna
Anna - avatar
+ 5
Thanks Anna and Seb TheS But I think SL should space the single quotes a bit cuz I thought that's a single double quote and was expecting error.😅
11th Apr 2019, 8:43 AM
Saksham Jain
Saksham Jain - avatar
+ 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)
11th Apr 2019, 8:47 AM
Anna
Anna - avatar
+ 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?
11th Apr 2019, 8:48 AM
Saksham Jain
Saksham Jain - avatar
+ 2
Empty string.
11th Apr 2019, 8:39 AM
Seb TheS
Seb TheS - avatar
+ 2
If they spread out the quotes, the player might suspect whitespace. Then it would be no empty string.
11th Apr 2019, 8:46 AM
HonFu
HonFu - avatar
+ 2
Hehe, no. :) Yeah, it is a bit awkward. One has to assume an empty string and hope that was meant.
11th Apr 2019, 8:57 AM
HonFu
HonFu - avatar
+ 2
And I dunno what would sololearn lose to make it "" like other languages for the sake of simplicity
11th Apr 2019, 3:34 PM
Saksham Jain
Saksham Jain - avatar
+ 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.
11th Apr 2019, 3:38 PM
HonFu
HonFu - avatar
+ 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
12th Apr 2019, 1:24 PM
Saksham Jain
Saksham Jain - avatar
+ 1
It would probably be good if code was presented with equally wide letters as you'd normally have it anyway.
11th Apr 2019, 9:04 AM
HonFu
HonFu - avatar
+ 1
In Challenges you can't use 'copy text' though. 😏
11th Apr 2019, 9:27 AM
HonFu
HonFu - avatar
0
Do you both think this will lead anywhere? Everybody has stopped caring!
11th Apr 2019, 3:32 PM
HonFu
HonFu - avatar