Python EOF Error when reading a line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python EOF Error when reading a line

First, I don't understand what does it mean I also searched for EOF Error on StackOverFlow only to find out problems about complicated codes I haven't learned yet. I don't get it why this program runs well on laptop but not on my phone. Here's my written code and I hope you amazing guys can tell you why this error is occuring in this situation:) https://code.sololearn.com/cFzmHv9STP3T/?ref=app

20th Apr 2017, 3:09 AM
Joel Bennett
Joel Bennett - avatar
3 Answers
+ 13
EOF means end-of-file. The inputs you send to the online compiler are put into a file. When your code needs an inputs, the compiler reads from the file line by line to provide them. But when it reaches the end of the file, and nothing else is left, you get an end-of-file error. This wouldn't happen on your computer because you can always provide more input when it's needed.
20th Apr 2017, 3:42 AM
Tamra
Tamra - avatar
+ 11
The input box at the start is meant for *all* of the inputs your code needs. You can't enter them "live" using an online compiler like here. If you wanted to use it here, you'd have to input the name and guesses in the input box, each on their own line. You might still run into EOF (end-of-file) if you don't guess correctly and the code looks for another input. :/
20th Apr 2017, 3:20 AM
Tamra
Tamra - avatar
+ 2
Oh, I didn't know that!! Thanks for suggesting the solution clearly..! Can you please explain the definition of EOF error in a more easier way?
20th Apr 2017, 3:31 AM
Joel Bennett
Joel Bennett - avatar