Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 5
Why this program taking input from comment? Is it BUG?
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/
+ 5
+ 4
Fź«ā²
į«į„Ķį„į„įƽ It's probably SoloLearn's bug. I tried the code on my IDE but it didnt ask user to input anything.
+ 3
Tibor Santa, Hasnain [ACTIVE CHALLENGER]
But it's still taking input from multi-line input
+ 2
In python the comments should be written in hashtag #ļøā£ not in single quote
+ 2
Read the yellow box in second lesson to know about it
+ 2
Hasnain [ACTIVE CHALLENGER]
It's also a valid way of commenting.
https://www.simplilearn.com/tutorials/JUMP_LINK__&&__python__&&__JUMP_LINK-tutorial/comments-in-python
+ 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 :) ")
+ 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 ++).
+ 1
This is not a way of commenting.
+ 1
I fixed the comment
https://code.sololearn.com/cgo9QoQgCJ3F/?ref=app
+ 1
Artin Azari So, they used regular expression in the code playground? Does this happen to other online compiler, as well?
+ 1
Artin Azari the comment "#input()" will stop the code playground from asking user for input, I checked.
+ 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.
+ 1
š²š²š²šØšØšØa very BIG bug you should report that to the sololearn...
0
That's not how you use comment.
For one line comment, use '#'.
For multi-line, I think you can use (" " "), or (' ' ').
0
Ok
0
Putting # before a = input() like
#a = input()
Is not asking for input so it's not a sololearn bug
0
Try to remove the input in the comment it will not ask for writting something.
so it's surely a sololearn bug