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)

10th Mar 2021, 4:15 AM
Diego Santamaria
Diego Santamaria - avatar
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 ;)
10th Mar 2021, 4:25 AM
visph
visph - avatar
+ 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 ;)
10th Mar 2021, 7:23 AM
visph
visph - avatar
0
oh woops! what a simple over sight! tha ks!
10th Mar 2021, 4:27 AM
Diego Santamaria
Diego Santamaria - avatar
0
Frogged this is an end of module project: there's no user input, but a ready to use input...
10th Mar 2021, 7:20 AM
visph
visph - avatar
0
visph please explain...didn't get u
10th Mar 2021, 7:22 AM
Oma Falk
Oma Falk - avatar
- 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.
10th Mar 2021, 7:18 AM
Oma Falk
Oma Falk - avatar