0
an indentation error
Could anyone help me with this code? https://code.sololearn.com/csGSdcPN5O8y/#py It always produces an indentation error after I double checked it for times...
2 ответов
+ 6
I don't get the indentation error, but EOF instead. You might want to put the input line inside the try/except clause to avoid it.
+ 6
You're getting an EOFError because of the way sololearn handles input and because you're asking for input in a loop.
Sololearn gives the user the oppotunity to give all the input the script needs just once.
Because you are in an infinite loop, eventually the inputs will be all consumed by the script.
After that, because the script will still be requesting more input, and it will not find more
it will throw the EOFError.
You can avoid this by providing a break to end the loop after the input is consumed.