When does an EOFError occur? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When does an EOFError occur?

I tried writing a code with a while loop, it keeps giving me an EOFError. But while using python 3.7.* IDLE it has no issues. import random comGuess=random.randint(0,100) while True: userGuess=int(input()) if userGuess>comGuess: print("Guess higher") elif userGuess<comGuess: print("Guess lower") else: print("congrats, you have guessed correctly") break

18th Jun 2018, 6:03 AM
William
2 Answers
+ 2
break should be in alignment with while true statement and not with if or else statements
18th Jun 2018, 1:25 PM
Sahil Danayak
Sahil Danayak - avatar
+ 5
SoloLearn doesn't provide a live console, so you are expected to provide all input prior to code interpretation. This is, however, infeasible in this situation.
18th Jun 2018, 6:23 AM
Hatsy Rei
Hatsy Rei - avatar