(Solved) This code outputs an error but I don't see an error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

(Solved) This code outputs an error but I don't see an error

It says there is an error in this code while n < 5: x=input() if int(x)< 3: continue total += 100 n += 1 print(total) The error: Trace back (most recent call last): File "usercode\file0.py", line 7, in <module> x=input() EOFError: EOF when reading a line Can someone tell me how to fix this

14th Jun 2022, 4:14 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
6 Answers
0
Post your task for this code also.. and save total code and share link. otherwise it's a guess game... If this is about a code coach which accept 5 inputs of ticket task then it will ask you to enter inputs infinitely until you enter 5 inputs with value >= 3. But you only need to accept 5 inputs. Add n+=1 just after taking jnput. Not at the end, otherwise continue cause it not to execute it... Hope it helps....
14th Jun 2022, 4:23 PM
Jayakrishna 🇮🇳
+ 1
Can you show your whole code by pasting it into the Code Playground and then sharing the link? I cannot tell if this is done in purpose but I don't see a preclared variable for n.
14th Jun 2022, 4:24 PM
Justice
Justice - avatar
0
I believe this is related to how sololearn takes input, makes sure you enter 4 lines in the input prompt
14th Jun 2022, 4:16 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
4 lines? What does that mean
14th Jun 2022, 4:23 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
Oh n was just a variable to repeat the loop, no need to worry about that
14th Jun 2022, 4:31 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
Thank you guys so much
14th Jun 2022, 4:31 PM
MyNameIsNotBob
MyNameIsNotBob - avatar