0

Why it works on real python3 but not here?

Hi, all. Please help to understand why it does not work here, all seems to be ok on pycharm. The error is "Traceback (most recent call last): File "..\Playground\", line 6, in <module> b = input('Guess number from 0 t0 10: ') EOFError: EOF when reading a line" Thanks in advance for your help! import random i = 0 while True: i += 1 a = random.randint(0, 10) b = input('Guess number from 0 t0 10: \n') try: number = int(b) if number >= 0 and number <= 10: if number == a: print ('Good job, you won!') print ("Attempts: ", i) break else: print ("Try again") print ('\n This time it was:', a) else: print ('Bad choise, should be from 0 to 10') except ValueError: print ('Your input should be integer!')

22nd Nov 2016, 2:19 PM
Stanislav Syarkevich
Stanislav Syarkevich - avatar
2 Respuestas
+ 2
I believe the error you are getting is to do with Sololearn's Python3 interpreter and the way it handles user input, as your code only crashes if it requires user input more than once. Unfortunately, until Sololearn fixes the issue, the only way around this would be to use Sololearn for writing/storing code (if that's what you want), but to run it using something else (IDLE, Command Line, www.repl.it).
22nd Nov 2016, 3:25 PM
apertje
apertje - avatar
+ 1
Thanks, apertje!
22nd Nov 2016, 6:22 PM
Stanislav Syarkevich
Stanislav Syarkevich - avatar