Help practice Pull the trigger | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help practice Pull the trigger

this my code p = 100 i = 1 while i <= 4: if input() == "hit": p += 10 elif input() == "miss": p -= 20 i += 1 print(p) I keep getting this error: Traceback (most recent call last): File "/usercode/file0.py", line 8, in <module> elif input() == "miss": EOFError: EOF when reading a line I have been traying for a while to discover whats the problem but i cant find it, please helppppppp!!!!

12th Dec 2021, 4:37 PM
Orlando San Jorge
Orlando San Jorge - avatar
2 Answers
+ 3
You have to indent the line where you increment i so it is inside the loop.
12th Dec 2021, 4:41 PM
Simon Sauter
Simon Sauter - avatar
0
As Simon Sauter said you have to indent i+= 1 to be inside the loop. You also have to make a variable inside the loop to take inputs exactly 4 times. while i <= 4: the_input = input()
13th Dec 2021, 11:48 AM
Mafdi
Mafdi - avatar