0

Eoferror

total = 0 i = 0 while i <=5: i += 1 age = int(input("insert age here")) if age < 3: continue else: total += 100 print(total) Getting EOFerror on line 5 can't work out why Exercise is to work out total price of tickets at $100 each but kids under 3 are free so need to continue rather than add for inputs lower than 3

6th Sep 2021, 12:32 AM
Brent Clifford
2 Antworten
+ 4
Your code requires six inputs. If there are less this happens.
6th Sep 2021, 12:37 AM
Simon Sauter
Simon Sauter - avatar
0
Changed the 5 in line 3 to a 4 and it worked. Looking back i could have also changed initial I value to 1 I think
6th Sep 2021, 12:42 AM
Brent Clifford