+ 1
Why do I get a trace error? Help pls (solved)
I’m trying to do one of the practice exercises which is calculate an average grade and output a value. Anyway, when I run this on my laptop it works fine, but when I do it on my phone it gives a traceback error on line 3. Does anybody see what’s the problem? Could you help me pls? Thanks name = input() sem1_score = int(input()) sem2_score = int(input()) avescore = (sem1_score + sem2_score) / 2 if avescore >= 90 and avescore <= 100: print(50) elif avescore >= 80 and avescore <= 89: print(30) elif avescore >= 70 and avescore <=79: print(10) else: print(0)
4 Respuestas
+ 6
probably because sololearn doesnt take interactive input. Here, you need to enter all inputs at the start of the program.
whats your input and expected output? And exactly what error did you get?
+ 1
the error says: Traceback (most recent call): “File/usercode/file0.py” line 3, in <module> sem2_score = int(input())
EOFError: EOF when reading a line
expected input is 67 and 84 and expected output is 10. Thanks
+ 1
Thank you! And yup, that EOF error gets thrown in this exact situation where it was expecting input and didnt get it. You can still run your programs here, when it asks for input, instead of typing:
67 (then hitting submit)
type:
67 ( then, in the same input box hit enter to go to the next line. This is how multiple inputs are gathered)
84
* THEN hit submit
+ 1
Thank you! It’s running perfectly now