an indentation error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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...

30th Mar 2017, 6:20 AM
W.Zhan
2 Answers
+ 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.
30th Mar 2017, 6:47 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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.
2nd Apr 2017, 3:34 AM
Ulisses Cruz
Ulisses Cruz - avatar