Why this program taking input from comment? Is it BUG? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5
6th Jun 2023, 6:45 AM
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ - avatar
19 Respostas
+ 7
You should not use a regular string literal as comment. Even if it is valid syntax, but semantically misplaced and confusing. Follow the PEP8 guidelines. https://stackoverflow.com/questions/708649/JUMP_LINK__&&__python__&&__JUMP_LINK-comments-vs-strings https://peps.python.org/pep-0008/
6th Jun 2023, 8:36 AM
Tibor Santa
Tibor Santa - avatar
6th Jun 2023, 6:55 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 4
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ It's probably SoloLearn's bug. I tried the code on my IDE but it didnt ask user to input anything.
6th Jun 2023, 10:59 AM
Dragon RB
Dragon RB - avatar
+ 3
Tibor Santa, Hasnain [ACTIVE CHALLENGER] But it's still taking input from multi-line input
6th Jun 2023, 10:37 AM
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ - avatar
+ 2
In python the comments should be written in hashtag #ļøāƒ£ not in single quote
6th Jun 2023, 6:49 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 2
Read the yellow box in second lesson to know about it
6th Jun 2023, 6:55 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
6th Jun 2023, 7:05 AM
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ - avatar
+ 2
I think this happens because of the using RegEx in Playground, and if your code contains any "input" word followed by an open parenthesis, causes the input box to show. Check below commands separately: print(" Word input with open parenthesis :( ") print(" Word input with close parenthesis :) ")
6th Jun 2023, 11:03 AM
Artin Azari
Artin Azari - avatar
+ 2
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ itā€™s not a Sololearn bug, because DOCSTRING is NOT a COMMENT. The text (code) in the ā€˜ā€™ā€™ ā€˜ā€™ā€™ partly executes. But the text (code) after # Doesnā€™t executes. Python hasnā€™t got multiline comments like C (not ++).
7th Jun 2023, 2:20 PM
Daniil Pivovarov
Daniil Pivovarov - avatar
+ 1
This is not a way of commenting.
6th Jun 2023, 6:48 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
6th Jun 2023, 10:37 AM
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ - avatar
+ 1
Artin Azari So, they used regular expression in the code playground? Does this happen to other online compiler, as well?
6th Jun 2023, 11:09 AM
Dragon RB
Dragon RB - avatar
+ 1
Artin Azari the comment "#input()" will stop the code playground from asking user for input, I checked.
6th Jun 2023, 11:10 AM
Dragon RB
Dragon RB - avatar
+ 1
Yes, my guess is that regex is used, but I don't know about other online IDEs. And about the comment using character #, sorry, I made a mistake.
6th Jun 2023, 11:35 AM
Artin Azari
Artin Azari - avatar
+ 1
šŸ˜²šŸ˜²šŸ˜²šŸ˜ØšŸ˜ØšŸ˜Øa very BIG bug you should report that to the sololearn...
7th Jun 2023, 5:11 PM
Excellence Kawej
Excellence Kawej - avatar
0
That's not how you use comment. For one line comment, use '#'. For multi-line, I think you can use (" " "), or (' ' ').
6th Jun 2023, 6:50 AM
Dragon RB
Dragon RB - avatar
0
Ok
6th Jun 2023, 10:35 AM
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ
Fź«€ā²…įƒ«į„†ĶŸį„™į„‰įƽ - avatar
0
Putting # before a = input() like #a = input() Is not asking for input so it's not a sololearn bug
8th Jun 2023, 4:14 AM
Vinay K
Vinay K - avatar
0
Try to remove the input in the comment it will not ask for writting something. so it's surely a sololearn bug
8th Jun 2023, 7:03 AM
Excellence Kawej
Excellence Kawej - avatar