+ 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
2 Antworten
+ 2
break should be in alignment with while true statement and not with if or else statements
+ 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.