+ 5

What am i doing wrong?

i am creating a calculator , it gives me correct answer but with warning eof error - eof error while reading a line. pls help me https://code.sololearn.com/cAuzRj37GV6z/?ref=app

17th Aug 2018, 9:21 AM
rajaram patel
rajaram patel - avatar
5 Antworten
+ 1
it works, I think it is Solo Learn and they eat they interpret input, I uploaded 2 images below showing how Solo Learn expects multiple inputs https://ibb.co/gcNBJK = inputs https://ibb.co/hZtwkz = output
18th Aug 2018, 8:49 AM
Steven M
Steven M - avatar
+ 4
Actually, you're doing nothing wrong! The problem is with Sololearn's code playground, that takes all the input in the beginning. Paste the code into IDLE for example, and it works like a charm :)
17th Aug 2018, 7:14 PM
Just A Rather Ridiculously Long Username
+ 2
Hi, it's the web surface... In the pop up window you need to enter all inputs at once on separate lines before submitting it. The problem is, that your loop will keep asking for user input endlessly. What you could do, is to add another if statement like "quit" for example, and use that to break the loop: ... if user_input == "quit": break ... Then if you run it, just type in as many test cases as you want, and add quit on the last line, submit them all at once and then it should work. For example: add 1 2 multiply 43 78 quit I don't know, if there's a better way, which can handle user input interactively... Anyway, I hope it helps!
17th Aug 2018, 6:22 PM
KSaccer
+ 1
use the elif statement instead of repeating if,
18th Aug 2018, 7:02 AM
Ariel Boutcher
Ariel Boutcher - avatar
- 4
hi every one
17th Aug 2018, 10:20 PM
Precious