Multiple calls to input() causes EOFError. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Multiple calls to input() causes EOFError.

Hi all! I have created a simple Math Warrior game where the opponents need to solve simple mathematical equations to win the game. However, the playground doesn't allow to use the input() function multiple times through out the code. This means, that I can't make the game work. Have you experienced the same issue? How can I bypass this limitation? Thank you in advance!

9th Feb 2018, 8:10 PM
Vladislav Sadykov
Vladislav Sadykov - avatar
5 Answers
+ 2
Yes, I know that it is not a problem of Python cause I have build the whole thing in Spyder and all works fine. I am aware that it is just a problem of the playground. So there is no way to bypass that limitation. Thanks for your participation in this discussion.
9th Feb 2018, 9:21 PM
Vladislav Sadykov
Vladislav Sadykov - avatar
+ 2
Ah okay, I misunderstood then. Unfortunately, SoloLearn is limited in that way and no way around it that I'm aware of. If you end up uploading it somewhere, let me know and I'll check the game out.
10th Feb 2018, 2:01 AM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
You can use the input() function as many times as you want. The problem is that your user needs to know EXACTLY how many inputs to input prior to even seeing the question, otherwise you'll get EOF due to not having input for required input. Get what I mean? Point being, if you want to have a math quiz on SoloLearn, your best bet is going to be web technologies (JS/html/etc..) since your players can interact with it and answer after the question is presented rather than before they know the question.
9th Feb 2018, 8:25 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
As mentioned, you can use input() as many times as you want. The problem isn't your code or python, it's the fact that SoloLearn's Code Playground requires you to give it ALL of your inputs prior to execution, which makes it difficult to create this type of game with Python -in SoloLearn-. It's a limitation of SoloLearn, not a limitation of Python. If you create the program in a Python editor, rather than SoloLearn's editor, you'll get the expected results.
9th Feb 2018, 9:16 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
Isn't there a function in Python which I can use multiple time to ask for user input?
9th Feb 2018, 8:38 PM
Vladislav Sadykov
Vladislav Sadykov - avatar