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)
3/10/2021 4:15:59 AM
Diego Santamaria6 Answers
New Answerwhen 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 ;)
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 ;)
Frogged this is an end of module project: there's no user input, but a ready to use input...
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.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message