+ 2

Cant correct the error in this code.

#i l am getting the error : EOFError: EOF when reading a line import random def magic_8ball(): x = input("What is your question? enter to quit:") Eightball_list = ["It is certain", "Outlook good","You may rely on it","Ask again later","Concentrate and ask again","Reply hazy, try again","My reply is no","My sources say no"] if x == "": print ("exiting...") else: print (random.choice(Eightball_list)) magic_8ball()

5th May 2017, 5:55 AM
buggythegret
buggythegret - avatar
2 Answers
+ 10
I actually ran it in CodePlayground and it worked... I did need to clean up indentation a little due to copy paste messing it up though.
5th May 2017, 6:18 AM
Ahri Fox
Ahri Fox - avatar
+ 4
On sololearn code playground, you cannot run real interractive programs, as code is distant running and so terminal output is emulated with the limitation of need to send all user input at once at start, and display text output at end, at once also... Each input need to be separate by a line break, but submitted in only once input, sended by clicking on validation button ( "enter" key is used to break lines of the text fiels ). Understanding this way of running codes, you can easily see why "real" interractivity isn't possible ( you cannot submit successive entries where next need knowing result of previous :P )
5th May 2017, 6:05 AM
visph
visph - avatar