Python Error Taking User Input | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

Python Error Taking User Input

Hey guys, can someone explain that error to me? I am totally confused. I used this line of Code ( age = int(input()) ) in another program and it worksā€¦. :( total = 0 #your code goes here x = 0 while x <= 5: x += 1 age = int(input()) if age < 3: continue total += 100 print(total)

17th Dec 2021, 4:50 PM
Felix L
Felix L - avatar
10 Respostas
+ 4
You're taking six (x=0 to x=5).
17th Dec 2021, 5:19 PM
Simon Sauter
Simon Sauter - avatar
+ 2
EOF Error occurs in sololearn when reading user input. Because it reads all lines in the beginning, so you have to enter all inputs in the input box in separate lines. Eg. (input) 5 10 20 49 8 90
17th Dec 2021, 5:07 PM
Sousou
Sousou - avatar
+ 1
In this particular case the EOF error occurs because you ask for more inputs than sololearn provides. Make sure your loop has the right amount of iterations.
17th Dec 2021, 5:15 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Oh of course, i really didnt see thatā€¦ thank you
17th Dec 2021, 5:20 PM
Felix L
Felix L - avatar
0
What type of error did you find? Do you mean EOF Error?
17th Dec 2021, 5:02 PM
Sousou
Sousou - avatar
0
Yes, its EOFError: EOF when reading a line. Its the line where i wanna store the input in the variable age
17th Dec 2021, 5:03 PM
Felix L
Felix L - avatar
0
This is a ā€žCode Coachā€œ task in a Course, so i canā€˜t enter the inputs by myselfā€¦. But there must be a way to solve the code coach right?
17th Dec 2021, 5:11 PM
Felix L
Felix L - avatar
0
I think i am asking for 5 inputs, because the while loop ends when x reaches 5. x is incremented by 1 in every iteration. Did i make any mistake there?
17th Dec 2021, 5:18 PM
Felix L
Felix L - avatar
0
You have to start from 1 then
19th Dec 2021, 4:39 AM
sanjit jha
sanjit jha - avatar
0
Or if you want to tak 5 inputs simply use for i in range(5):
19th Dec 2021, 4:40 AM
sanjit jha
sanjit jha - avatar