0
python ticketing system eof
Can someone tell me why I’m getting EoF error? This should work: total = 0 itr = 0 while itr < 5: x = input() print(x) if int(x) < 3: continue else: total += 100 itr += 1 print(total)
6 Réponses
+ 2
when input is lower than 3, itr variable is not incremented, so your loop will run more than expected ^^
you could fix it by moving the incrementation of itr at start of ypur loop ;)
+ 1
Frogged even if it was user input, if user think there's only 5 values to give as input, if there's more input than expected (and user filled all at once), there will be an eof error...
on end of moule project, inputs are provided programatically, not by user ;)
0
oh woops! what a simple over sight! tha ks!
0
Frogged this is an end of module project: there's no user input, but a ready to use input...
0
visph please explain...didn't get u
- 1
But that's not the point for eof...
It is the input() in the while loop.
SL gets input only once for all inputs in prog.