+ 2

Help with EOFError [SOLVED]

There is this EOFError popping up. I don't get it quite, because it says it is in a line I didn't even write!? I wanted to make a calculator typing in only one line in user input (like 45+12) I tried to except the error but then there is still no output :( Can somwocheck it?? https://code.sololearn.com/cm1rlfP8ZkMF/?ref=app

22nd Aug 2020, 10:55 AM
Erion Leka
Erion Leka - avatar
4 Antworten
+ 6
As there is only one input to give, the problem does not come from the input behavior of playground. The first issue is that you use try: without having an except: for this. when I iserted an except at the end of the code, the program is running in this section, so there is something that causes an error. Put this snippet at the end of your code, and try to find out what is happening: .... except Exception as e: print('except reached', e)
22nd Aug 2020, 11:31 AM
Lothar
Lothar - avatar
+ 7
You have to put the whole input at once (at the starting) only!
22nd Aug 2020, 10:57 AM
Namit Jain
Namit Jain - avatar
+ 1
Can you explain it further. I'm sorry, I am a newbie .. Do you mean input in the first line of code?
22nd Aug 2020, 10:58 AM
Erion Leka
Erion Leka - avatar
+ 1
Thank you! both of you
22nd Aug 2020, 12:10 PM
Erion Leka
Erion Leka - avatar